Redirection
Cheat sheet · https://pcornel.dk/topic.php?topic=3057
Answer
Redirection sends command output or input to files: > overwrites, >> appends, 2> redirects errors, 2>&1 merges errors with output, and < reads input from a file, such as dir > list.txt 2>&1.
Remember
- > overwrites a file, >> appends to it.
- 2>&1 sends errors to the same place as output.
- Redirection order matters: > file 2>&1 works, 2>&1 > file does not.
First checks
echo %PATH%— PATH in CMDset— environment variableswhere <name>— command resolutionecho %ERRORLEVEL%— exit code
Verify in this order
cmd.exe opens target files → handles redirected → command writes to them
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=3057