Exit Code

noun

say it: “EG-zit KOHD” /ˈɛɡzɪt ˈkoʊd/

A number a program gives back when it ends, 0 meaning it worked and any other number meaning it did not.

What is an exit code?

An exit code is the number every program hands back when it finishes: 0 means it worked, and any other number means something went wrong, the number saying what. In PowerShell, $LASTEXITCODE holds the last program's exit code; in bash, $? does.

where.exe robocopy
$LASTEXITCODE        # 0: it was found

In a sentence

  • “where.exe rsync ended with exit code 1, because there was no rsync.”
  • “The script checks the program's exit code before it carries on.”

Level: Apprentice · More Operating System terms at this level

Updated

In other subjects