Run a powershell script in the background once per minute

后端 未结 8 2151
攒了一身酷
攒了一身酷 2020-12-23 16:38

I want a powershell script to be run once per minute in the background. No window may appear. How do I do it?

8条回答
  •  一整个雨季
    2020-12-23 17:17

    Schedule your task to be run as System. The command below will schedule a script to be run in the background without showing powershell console window:

    schtasks /create /tn myTask /tr "powershell -NoLogo -WindowStyle hidden -file myScript.ps1" /sc minute /mo 1 /ru System

    /ru switch lets you change the user context in which the scheduled task will be executed.

提交回复
热议问题