PATH
Cheat sheet · https://pcornel.dk/topic.php?topic=2934
Answer
PATH is an environment variable containing an ordered, semicolon-separated list of directories used during executable/command resolution. The exact resolution algorithm depends on the caller: cmd, PowerShell and application-launch APIs can apply additional rules before or around PATH.
Remember
- PATH is ordered; an earlier matching executable can shadow a later one.
- PowerShell can resolve aliases, functions and cmdlets before external applications, so PATH is not its only command-resolution layer.
PATHEXTaffects extensionless executable lookup in Windows command environments.- PATH is inherited through process environment state; newly configured entries may require a new shell/process.
- Writable or untrusted directories early in PATH can create command-hijacking risk.
First checks
$env:Path -split ';'— search directories in orderGet-Command <name> -All— every match PowerShell findswhere.exe <name>— matches in CMD search order[Environment]::GetEnvironmentVariable('Path','Machine')— machine PATH
Verify in this order
command name → current directory (CMD) / PATH order and PATHEXT → first match executed
Where it usually breaks
First mismatch in target identity/version → persistent configuration/source of truth → provider/service/control plane → runtime/effective state → user/workload-visible result → event/log evidence; preserve identity/native error/pre-state before mutation.
PATH troubleshooting boundaries
| Boundary | Check | Common failure |
|---|---|---|
| Process environment | current PATH value | shell inherited stale PATH |
| Shell resolution | aliases/functions/cmdlets vs external command | PowerShell resolves another command type first |
| Directory order | first matching executable | older copy shadows desired tool |
| Extension rules | PATHEXT / explicit extension | extensionless command not resolved as expected |
| Filesystem/access | executable exists and can be accessed | PATH is correct but file missing/blocked |
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=2934