Menu

7-Zip 7z.exe ERRORLEVEL Codes

2008-12-11
2012-12-08
  • Stephen Charles Thompson

    I have been unable to find an authoritative reference for ERRORLEVEL codes for 7z.exe, the command-line version of 7-Zip.

    All I have been able to find are examples of %ERRORLEVEL% statements scattered across the net.

    Will somebody on the design team PLEAZE post this?  It would be nice if it was in the docs or viewable by command line (e.g. >7z c).

     
    • Stephen Charles Thompson

      For the record I have cobbled together these examples:

      Code / Meaning
      0 / No error
      1 / Warning (Non fatal error(s)). For example, one or more files were locked by some other application, so they were not compressed.
      2 / Fatal error
      3 / change identified (does this indicate a change in the archive file itself or a difference when comparing archive file contents to the original source?)
      7 / Command line error
      8 / Not enough memory for operation
      255 / User stopped the process

       
    • Stephen Charles Thompson

      Igor pointed out the "Exit Codes" section of the help file.  It does not contain ALL of the errorlevel codes.

      I am getting an errorlevel 3 that is undocumented.  It appears to be the result of testing a file that has been updated since its initial creation.

      Again, will somebody please post documentation of all errorlevel/exit codes?

       
      • MoHaG

        MoHaG - 2008-12-12

        Download the source code, do a grep for exit, find a value, grep for that, find that ExitCode.h contains it all: (grep can ber optained several ways, I prefer services for Unix, but some smaller downloads should be available as well)
          kSuccess       = 0,     // Successful operation
          kWarning       = 1,     // Non fatal error(s) occurred
          kFatalError    = 2,     // A fatal error occurred
          // kCRCError      = 3,     // A CRC error occurred when unpacking
          // kLockedArchive = 4,     // Attempt to modify an archive previously locked
          // kWriteError    = 5,     // Write to disk error
          // kOpenError     = 6,     // Open file error
          kUserError     = 7,     // Command line option error
          kMemoryError   = 8,     // Not enough memory for operation
          // kCreateFileError = 9,     // Create file error

          kUserBreak     = 255   // User stopped the process

        (From latest source, note that several codes are commented out)

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.