Set up PowerShell Script for Automatic Execution

前端 未结 5 1585
有刺的猬
有刺的猬 2020-12-24 08:19

I have a few lines of PowerShell code that I would like to use as an automated script. The way I would like it to be able to work is to be able to call it using one of the f

5条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-24 08:47

    Save your script as a .ps1 file and launch it using powershell.exe, like this:

    powershell.exe .\foo.ps1
    

    Make sure you specify the full path to the script, and make sure you have set your execution policy level to at least "RemoteSigned" so that unsigned local scripts can be run.

提交回复
热议问题