Announcement

Collapse
No announcement yet.

Command Line Exit Codes

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Command Line Exit Codes

    Anyone know how to get or use the new command line exit codes? I thought this was %ERRORLEVEL%, but all I get are zeros even when errors occur.

    Originally posted by i_changes
    - Command line, /convert: exit codes added: 0 = OK, 1 = load error, 2 = save error
    Originally posted by Help
    - IrfanView exit code is 0. If /convert or /print is used, there is 1 or 2 also possible, for load/save errors.

    #2
    Here’s a very simple example:

    Code:
    @echo off
    cls
    
    C:\IrfanView\i_view32.exe "C:\Bilder\Bild 01.png" /convert="C:\Bilder\Bild 01.bmp"
    
    if errorlevel 2 goto E2
    if errorlevel 1 goto E1
    if errorlevel 0 goto E0
    
    :E2
    echo Errorlevel 2
    goto :EOF
    
    :E1
    echo Errorlevel 1
    goto :EOF
    
    :E0
    echo Errorlevel 0
    goto :EOF
    If exist ”C:\Bilder\Bild 01.png”, 'IrfanView' returns the errolevel ”0”; otherwise 'IrfanView' returns the errorlevel ”1”.

    Finally 'IrfanView' returns the errorlevel ”2”, if you type:

    Code:
    C:\IrfanView\i_view32.exe "C:\Bilder\Bild 01.png" /convert="C:\Bilder\*.bmp"
    »Und so, in eurer Verzweiflung, kommt ihr zu mir.«

    Texteditor EmEditor:
    Deutsche Sprachdatei (v7.01) für EmEditor Pro 7.02 (englisch)
    EmEditor Pro 8.06 (deutsch) | Deutsche Sprachdatei (v8) für EmEditor Pro 8.06 (englisch)
    Deutsche Sprachdatei (v9.16) für EmEditor Pro 9.17 (englisch)

    Comment


      #3
      Thanks Foxy. I didn't try it as a batch file, only from command prompt.

      Comment

      Working...
      X