Batch file 重试plink批处理文件错误
有时在发送那批时Batch file 重试plink批处理文件错误,batch-file,plink,Batch File,Plink,有时在发送那批时 plink 192.168.X.Y -l Admin -pw password -m C:\vsreset.txt 其中vsreset.txt是 POWER reset 我收到一些错误,比如 FATAL ERROR ..... 我想创建一个批,在“未发现错误”之前重试 我该怎么做 我试过这样的东西 c:\reset.bat | FIND "ERROR" > NUL IF ERRORLEVEL 1 resetplus.bat 但是我总是收到errorlevel=1,
plink 192.168.X.Y -l Admin -pw password -m C:\vsreset.txt
其中vsreset.txt是
POWER reset
我收到一些错误,比如
FATAL ERROR .....
我想创建一个批,在“未发现错误”之前重试
我该怎么做
我试过这样的东西
c:\reset.bat | FIND "ERROR" > NUL
IF ERRORLEVEL 1 resetplus.bat
但是我总是收到errorlevel=1,并且例程不会停止…
find
返回1
,当它不查找搜索字符串时,您需要这样的内容:
@echo off
:repeat
plink 192.168.x.x ... | find "ERROR" >nul
if %errorlevel% equ 0 goto repeat
或更短:
@echo off
:repeat
plink 192.168.x.x ... | find "ERROR" >nul && goto repeat