Pcornel
Windows · Command Prompt

Environment Variables

Cheat sheet · https://pcornel.dk/topic.php?topic=3055

Back to the Topic

Answer

Environment variables hold settings like PATH, TEMP and USERNAME for processes. In cmd use %NAME% and set or setx; system and user variables are stored in the registry and inherited by new processes.

Remember

  • PATH order decides which executable runs.

First checks

  • echo %PATH% — PATH in CMD
  • set — environment variables
  • where <name> — command resolution
  • echo %ERRORLEVEL% — exit code
  • setx <NAME> <value> — persist a user variable

Verify in this order

variable set (session or persistent) → expanded at parse time (%var%) or run time (!var!) → passed to children

Where it usually breaks

First mismatch in definition/configuration → security context → service/task/process creation → runtime state → output/side effect → event/performance evidence; preserve identity/native error/pre-state before mutation.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=3055

Confirmation

Confirm action

Continue?