我想设置一个任务调度程序,每1小时运行一次PowerShell脚本,没有提示窗口弹出。
下面是我尝试过的命令:
schtasks /create /sc hourly /tn $Task-Name /st $ScheduleTime `
/tr "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -windowstyle hidden -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -command C:\MyScript.ps1" `我添加了我找到的所有参数。
-windowstyle hidden -NoLogo -NonInteractive -NoProfile脚本在后台运行,没有任何问题,但它在开始时仍会弹出一秒钟,然后隐藏自己。
有没有人知道如何让任务调度器运行ps1脚本,不需要弹出窗口就可以完全隐藏?
发布于 2021-09-16 14:43:13
我要通过任务调度程序来实现这一点,我已经设置了操作值,以便使用以下参数启动powershell程序:
-executionpolicy bypass -noninteractive -file "C:\PathToYourScript"
这里的关键参数是-noninteractive,它不向用户提供交互式提示。
https://serverfault.com/questions/1059707
复制相似问题