0

コマンド ウィンドウに「ref_eng が見つかりません...」と出力された場合、プログラムを特定のコマンド セットにリダイレクトしたいのですが、どうすればこれを実現できますか? 以下のコードで、For を含む 2 行目は、cmd.exe が !refLogPath! 存在しません。この時点で、プログラムを別の場所にリダイレクトしたいと思います...

<!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!
                           )
                       )    
    )
4

1 に答える 1

0

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...
于 2012-07-13T03:52:44.257 に答える