1

Autosys には、かなり単純な DOS バッチ ファイル (.CMD) を実行するジョブがあります。ジョブが条件付きで失敗した場合、どのように Autosys に連絡しますか? 実行して終了すると、Autosys は何があっても成功を報告します。内部で決定された条件に基づいてスクリプトが失敗した場合、プログラムで Autosys に通知したいと思います。

どんな助けでも大歓迎です。前もって感謝します。

4

2 に答える 2

2

ERRORLEVEL を使用し、DOS ボックスを開いて「help if」と入力できます。これらのビットは関連しています。

C:\help if
Performs conditional processing in batch programs.

IF [NOT] ERRORLEVEL number command
IF [NOT] string1==string2 command
IF [NOT] EXIST filename command

  NOT               Specifies that Windows should carry out
                    the command only if the condition is false.

  ERRORLEVEL number Specifies a true condition if the last program run
                    returned an exit code equal to or greater than the number
                    specified.


%ERRORLEVEL% will expand into a string representation of
the current value of ERRORLEVEL, provided that there is not already
an environment variable with the name ERRORLEVEL, in which case you
will get its value instead.  After running a program, the following
illustrates ERRORLEVEL use:

    goto answer%ERRORLEVEL%
    :answer0
    echo Program had return code 0
    :answer1
    echo Program had return code 1
于 2010-10-31T18:59:20.057 に答える
1

あなたがする必要があるのはあなたの.batファイルの最後の行が次のように言うべきです:

EXIT /B %ErrorLevel%
于 2011-05-05T12:31:36.287 に答える