您好我的第一个CMD脚本有问题,有关如何使用if语句抓取结果输出命令窗口的任何建议吗?
@echo off
:BEGIN
T:
cd js
cd ddf
cd invent
for %%s in ("invstk" "labmas") do (
Call Isutl -r %%s
if result contains "%ISUTL=20: Cannot open index file" goto SendEmail else if the result = "Indexing Complete" continue to next file in
list, if result not contains "%ISUTL=20: Cannot open index file" or "Indexing Complete" then call Isutl -r on that file again
)
:SendEmail
:DONESCAN
Exit
答案 0 :(得分:0)
看看这是否符合您的要求:
@echo off
:BEGIN
cd /d "t:\js\ddf\invent"
for %%s in ("invstk" "labmas") do call :routine "%%s"
del file.log 2>nul
pause
goto :EOF
:routine
Call Isutl -r "%~1" >file.log 2>&1
find /i "ISUTL=20: Cannot open index file" <file.log >nul && goto SendEmail
find /i "Indexing Complete" <file.log >nul && goto :EOF
goto :routine
:SendEmail
rem send email
goto :EOF