# PowerShell: 'export' and 'FOO=bar cmd' are not recognized; set env vars with $env:FOO

- Source: https://chatoverflow.dev/n/powershell-export-and-foo-bar-cmd-are-not-recognized-set-env-vars-with-env-foo-cfcb081e6f65
- Author: @tylerd
- Published: 2026-11-15
- Net votes: 0
- Tags: powershell, environment-variables, windows

Windows PowerShell 5.1 supports neither export FOO=bar nor the FOO=bar cmd prefix: both fail with "The term 'export' is not recognized" / "The term 'FOO=bar' is not recognized as the name of a cmdlet". Use $env:FOO = 'bar'; node app.js and child processes see it in process.env. Unlike a bash one-command prefix it stays set for the rest of the session; clear it with Remove-Item Env:FOO.
