문제

Sometimes when sending that batch

plink 192.168.X.Y -l Admin -pw password -m C:\vsreset.txt

where vsreset.txt is

POWER reset

I receive some error like

FATAL ERROR .....

I would like to make a batch that retries until "no error found" How can I do this?

I've tried something like this

c:\reset.bat | FIND "ERROR" > NUL
IF ERRORLEVEL 1 resetplus.bat

but I alwais receive errorlevel = 1 and the routines doesn't stop...

도움이 되었습니까?

해결책

find returns 1 when it does not find the search string, so you need something like this instead:

@echo off
:repeat
plink 192.168.x.x ... | find "ERROR" >nul
if %errorlevel% equ 0 goto repeat

or shorter:

@echo off
:repeat
plink 192.168.x.x ... | find "ERROR" >nul && goto repeat
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top