'PowerShell' is not recognized as an internal or external command

333Mhz picture 333Mhz · Dec 25, 2014 · Viewed 20.7k times · Source

I have just installed Chocolatey via PowerShell, I tried running PowerShell both as myself and as administrator, and if I try running choco or cinst I get the following error:

PS C:\> choco /?
'PowerShell' is not recognized as an internal or external command,
operable program or batch file.

What do I do? I have a feeling this is related to more than just Chocolatey...

Answer

user4386814 picture user4386814 · Dec 25, 2014

This can happen if a program is not on your PATH. Open a PowerShell prompt and enter

[environment]::setEnvironmentVariable('PATH',
"$env:path;C:\Windows\System32\WindowsPowerShell\v1.0", 'm')

then restart PowerShell.