PowerShell says “execution of scripts is disabled on this system.”

前端 未结 30 2471
傲寒
傲寒 2020-11-22 00:45

I am trying to run a cmd file that calls a PowerShell script from cmd.exe, but I am getting this error:

Management_Instal

30条回答
  •  臣服心动
    2020-11-22 01:28

    If you're here because of running it with Ruby or Chef and using `` system execution, execute as follows:

    `powershell.exe -ExecutionPolicy Unrestricted -command [Environment]::GetFolderPath(\'mydocuments\')`
    

    That command is for getting "MyDocuments" Folder.

    -ExecutionPolicy Unrestricted does the trick.

    I hope it's helpful for someone else.

提交回复
热议问题