12

'Set-ExecutionPolicy' is not recognized as an internal or external command, operable program or batch file. getting this error while trying to install chocolaty through cmd

Manisha
  • 231
  • 1
  • 3
  • 12

4 Answers4

28

Set-ExecutionPolicy is a PowerShell Cmdlet. You should run it in a PowerShell (Admin-) Session, not in cmd.

Take a look at the installation instructions from chocolatey.org. Official chocolatey documentations is pretty good, as I think:

https://chocolatey.org/install#individual

Malte
  • 301
  • 2
  • 3
  • this is the correct command sequence under this link: https://chocolatey.org/docs/installation @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "[System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin" – Oliamster Apr 20 '20 at 14:58
1

'Set-ExecutionPolicy' is not recognized as an internal or external command, operable program or batch file while installing chocolaty for this question I think you are using command prompt but Set-ExecutionPolicy is a command only for powershell.

1

Just right click on "powershell" then choose "run as adminstrator"

Abdallah Mahmoud
  • 491
  • 1
  • 5
  • 8
0

Dont choose command prompt instead of power shell we think that both are same but its not Search Window power shell->run as administrator then run this code