Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Batch file DOS CMD向Autosys发送失败_Batch File_Autosys - Fatal编程技术网

Batch file DOS CMD向Autosys发送失败

Batch file DOS CMD向Autosys发送失败,batch-file,autosys,Batch File,Autosys,在Autosys中,我有一个执行相当简单的DOS批处理文件(.CMD)的作业。如果作业有条件失败,如何与Autosys通信?如果它运行并终止,Autosys将报告成功,无论发生什么情况。我希望根据在中确定的条件,以编程方式告诉Autosys脚本是否失败 任何帮助都将不胜感激。提前谢谢 您可以使用ERRORLEVEL,打开DOS框并键入“help if” 这些位是相关的: C:\help if Performs conditional processing in batch programs.

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


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

您可以使用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

您可以使用ERRORLEVEL,打开DOS框并键入“帮助如果” 这些位是相关的:

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

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

EXIT /B %ErrorLevel%

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

EXIT /B %ErrorLevel%

我已经将“返回代码”理解为识别成功/失败,但您已经将其包含到解决方案中,而不是黑客。非常感谢。这是一个怎样的解决方案?除非您指定退出/b[returncode],否则AutoSys将不会检测到%errorlevel%,因为我已将“返回代码”确定为识别成功/失败的代码,但您已将其包含到解决方案中,而不是黑客。非常感谢。这是一个怎样的解决方案?除非指定退出/b[returncode],否则AutoSys不会检测到%errorlevel%