Errorlevel

 

When a program stops, it returns an exit code to MS-DOS. For example, a

value of 0 is typically used to indicate that a program was successfully

executed. The ERRORLEVEL parameter lets you use exit codes as conditions.


The following example displays an error message if an error occurs during

formatting of the disk in drive A. If no error occurs, the error message is

skipped.


    :begin

    echo off

    format a: /s 

    if not errorlevel 1 goto end 

    if errorlevel 2 goto other 

    echo An error occurred during formatting.

  : other

    echo  do other things

    :end

    echo End of batch program.

 

 

http://users.cybercity.dk/~bse26236/batutil/help/CHOICE_E.HTM#el 

 

相关文章:

  • 2022-12-23
  • 2021-11-14
  • 2021-06-06
  • 2021-10-03
  • 2022-12-23
  • 2021-11-18
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-23
  • 2021-11-23
  • 2021-12-02
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案