在Autosys中,我有一个作业,它执行一个相当简单的DOS批处理文件(.CMD)。如果作业有条件地失败,我如何与Autosys通信?如果它运行并终止,Autosys无论如何都会报告成功。我想以编程方式告诉Autosys,如果脚本根据中确定的条件失败。
任何帮助都将不胜感激。提前谢谢。
发布于 2010-11-01 02:59:20
你可以使用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发布于 2011-05-05 20:31:36
您需要做的是,.bat文件的最后一行应显示以下内容:
EXIT /B %ErrorLevel%https://stackoverflow.com/questions/3960920
复制相似问题