Native Command

noun

say it: “NAY-tiv kuh-MAND” /ˈneɪtɪv kəˈmænd/

A program that PowerShell starts but doesn't run itself, such as git or npm; it hands back plain text and reports success with an exit code.

What is a native command in PowerShell?

A native command is any program that isn't a PowerShell command: git, dotnet, npm, robocopy. You run it by its name, the same as in Command Prompt or bash. It hands back text, one string for each line it prints, and it reports success or failure through its exit code, not through PowerShell's errors.

$commit = git rev-parse --short HEAD   # a native command
$commit                               # 05d4acb
$LASTEXITCODE                         # 0: it worked

In a sentence

  • “git is a native command, so its output comes back as lines of text.”
  • “After a native command runs, $LASTEXITCODE holds its exit code.”

Level: Journeyman · More PowerShell terms at this level

Updated