Redirect 是否基于批处理中的输出?
如果cmd窗口输出:“找不到ref_eng…”,我想将我的程序重定向到一组特定的命令,我如何才能做到这一点?在下面的代码中,包含For的第2行是cmd.exe可以输出“找不到ref_eng”if!重熔路径!不存在。此时,我想将我的程序重定向到其他地方Redirect 是否基于批处理中的输出?,redirect,if-statement,batch-file,for-loop,Redirect,If Statement,Batch File,For Loop,如果cmd窗口输出:“找不到ref_eng…”,我想将我的程序重定向到一组特定的命令,我如何才能做到这一点?在下面的代码中,包含For的第2行是cmd.exe可以输出“找不到ref_eng”if!重熔路径!不存在。此时,我想将我的程序重定向到其他地方 <!logPath! ( For /F "tokens=*" %%R in (!refLogPath!) DO ( if %ERRORLEVEL% NEQ 0 ( ECHO Check certain lines of
<!logPath! (
For /F "tokens=*" %%R in (!refLogPath!) DO (
if %ERRORLEVEL% NEQ 0 (
ECHO Check certain lines of code
)
set logLine=
set /p logLine=
set refLogLine=%%R
REM Check line by line of log against refLog
REM assume ALL times have been replaced with: "xx:xx:xx"
REM if corresponding lines mismatch
if NOT "!logLine!"=="!refLogLine!" (
Echo.
Echo line below is Incorrect:
set lnCorrect=false
REM output to command line: can be put into .log/.txt later
REM output ANY and ALL incorrect line in log file
ECHO !logLine!
)
)
)
在for循环之前检查refLogPath
例如:
if !refLogPath!xx == xx (
REM refLogPath is empty or unset
goto :SomewhereElse
) else (
if not exist !refLogPath! (
REM refLogPath is missing
goto :SomewhereElse
)
)
For /F "tokens=*" %%R in (!refLogPath!) DO (
...etc...