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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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).
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
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?
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)