> net helpmsg 2 The system cannot find the file specified. If the program is well-known (e.g., robocopy , xcopy ), consult its documentation—they reuse Win32 error codes with different meanings.

Crucially, the exit code is the return value of main() in the C runtime sense. The CRT wraps main() , captures its return value, and passes it to ExitProcess() . If you never call ExitProcess explicitly, the CRT does it for you.

This layering leads to a key insight: . The default for a thread is STATUS_THREAD_TERMINATED (0x00000100); for a process, it is STATUS_PENDING (0x00000103) until termination, then the final code. 2. The Semantic Wasteland: What Does Non-Zero Mean? Unlike Unix, where exit codes are small (0–255) and often mapped to sysexits.h conventions, Windows exit codes are full 32-bit values, blending several distinct categories: