9

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...

3 Answers 3

12

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.

2
2

I found this helpful.

  • Write cmd in the start menu, right-click and run as administrator.
  • Then in the cmd, paste in this to install choco

@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin

0
2

Put Chocolatey on the path.

Edit the system environmental variable. Go to

System PropertiesAdvancedEnvironment VariablesSystem variablesPATHEditNew

Look for where Chocolatey is. In my case it was at C:\ProgramData\chocolatey. Enter that, don't forget to put "\" after Chocolatey. I.e., it should be: C:\ProgramData\chocolatey\

1
  • The only solution that worked for me after losing all PATH variables
    – testing_22
    May 10, 2021 at 1:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.