Exit Codes Windows | Limited Time
If yes, it's either an NTSTATUS (0xCxxxxxxx) or HRESULT (0x8xxxxxxx). Use the Visual Studio tool err.exe or net helpmsg :
These are STILL_ACTIVE (thread) and STATUS_PENDING (process). Seeing them from GetExitCodeProcess means you called it before the process actually exited. This is a classic race. exit codes windows
> err 0xC0000005 # for hex 0xc0000005 / decimal -1073741819 STATUS_ACCESS_VIOLATION Check against Win32 error codes: If yes, it's either an NTSTATUS (0xCxxxxxxx) or
PowerShell-native commands return rich objects, not exit codes. When you run an external .exe , PowerShell captures its exit code in $LASTEXITCODE , but the PowerShell process's own exit code is set only by exit $n . A script that runs non-existent.exe will see $LASTEXITCODE = 0xC0000135 (STATUS_DLL_NOT_FOUND), but the PowerShell process itself exits with 0 unless you explicitly forward it. 4. The Debugger's Compass: Interpreting Exit Codes as Clues For a systems engineer, an unexpected exit code is a compressed diagnostic. Here’s how to decompress it: This is a classic race
In cmd.exe , the exit code of a batch file is the exit code of the last command executed . A batch file that copies a file and then echoes a message will return 0 even if the copy failed, because echo always succeeds. This forces developers to use exit /b %errorlevel% explicitly.
This overlap is a trap: an exit code of 2 could mean "invalid parameter" (application-defined), or it could mean ERROR_FILE_NOT_FOUND from a failed CreateFile . Without the program's documentation, you cannot disambiguate. Three common scenarios produce exit codes that are technically correct but semantically useless: