Skip to content

command -v silently reports every tool as missing

aliases · case

bothsilentagentscriptfirst-partyrepro: verifiedabsent-builtin-noop
Affectspowershell 51, pwsh 7, windows
Fails assilent
Mechanismabsent builtin noop
Safe fixget command

An agent (or a ported bash script) probes for a tool with command -v foo under PowerShell. The probe prints nothing and the script concludes the tool is missing — even though it is installed and on PATH. Installs get re-run, bootstraps loop, “missing dependency” errors lie.

Terminal window
command -v git # prints nothing, no error, $? stays true
Get-Command git # works: CommandType Application, path shown

PowerShell has no command builtin. Depending on parse context, command -v git either matches nothing quietly or binds to unrelated tokens; it raises no error and sets no useful exit state. The bash idiom fails in the WORST way: silently, with a plausible-looking negative result.

  • Probe with Get-Command <tool> -ErrorAction SilentlyContinue (null check) or simply run <tool> --version and check $LASTEXITCODE.
  • Agent prompts targeting Windows must map command -vGet-Command; the referenced commit ships that rule as a documented shell-hazard contract.