首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >DOS CMD向Autosys发送失败

DOS CMD向Autosys发送失败
EN

Stack Overflow用户
提问于 2010-10-18 23:59:02
回答 2查看 3.9K关注 0票数 1

在Autosys中,我有一个作业,它执行一个相当简单的DOS批处理文件(.CMD)。如果作业有条件地失败,我如何与Autosys通信?如果它运行并终止,Autosys无论如何都会报告成功。我想以编程方式告诉Autosys,如果脚本根据中确定的条件失败。

任何帮助都将不胜感激。提前谢谢。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2010-11-01 02:59:20

你可以使用ERRORLEVEL,打开一个DOS框,输入'help if‘这些位是相关的:

代码语言:javascript
复制
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
票数 2
EN

Stack Overflow用户

发布于 2011-05-05 20:31:36

您需要做的是,.bat文件的最后一行应显示以下内容:

代码语言:javascript
复制
EXIT /B %ErrorLevel%
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/3960920

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档