How do I execute a PowerShell script automatically using Windows task scheduler?

后端 未结 9 1718
甜味超标
甜味超标 2020-11-29 23:24

I have one PowerShell script which sends emails. I want to execute that script automatically, every 1 minute. How can I do it, using task scheduler?

Currently I have

9条回答
  •  借酒劲吻你
    2020-11-30 00:03

    Instead of only using the path to your script in the task scheduler, you should start PowerShell with your script in the task scheduler, e.g.

    C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe -NoLogo -NonInteractive -File "C:\Path\To\Your\PS1File.ps1"
    

    See powershell /? for an explanation of those switches.

    If you still get problems you should read this question.

提交回复
热议问题