windows 如何使用SCHTASKS在SYSTEM用户帐户下创建计划任务
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6477807/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to create a scheduled task under SYSTEM user account with SCHTASKS
提问by Mike
I am currently trying to get SCHTASKS to create a scheduled task under the SYSTEM account, by using the following command:
我目前正在尝试使用以下命令让 SCHTASKS 在 SYSTEM 帐户下创建计划任务:
schtasks.exe" /s "\" /u "SYSTEM" /Create /SC DAILY /MO "7" /ST "12:00" /TN "mytask" /TR "C:\test.exe "C:\""
Although it outputs:
虽然它输出:
ERROR: User credentials are not allowed on the local machine.
回答by gonzobrains
Open an elevated (admin) command prompt.
Enter the following command:
schtasks.exe /s "\" /ru "SYSTEM" /Create /SC DAILY /MO "7" /ST "12:00" /TN "mytask" /TR "C:\test.exe "C:\"
打开提升的(管理员)命令提示符。
输入以下命令:
schtasks.exe /s "\" /ru "SYSTEM" /Create /SC DAILY /MO "7" /ST "12:00" /TN "mytask" /TR "C:\test.exe "C:\"
Please note the difference is that, in order to specify the SYSTEM account, you need to use the /RU
switch and not the /U
one.
请注意不同之处在于,为了指定 SYSTEM 帐户,您需要使用/RU
开关而不是开关/U
。
回答by Under A Tree
- Create your tasks in scheduler them export them as XML (https://superuser.com/questions/1334495)
- Create a text file with: schtasks.exe /create /RU SYSTEM /TN "Folder\TaskName" /XML "I:\Location\TaskName.xml" as many lines as you want, with each task, then save file as batch (.bat), run as administrator (right click run as admin).
- Apply to computers that you want to run it on.
- 在调度程序中创建您的任务,将它们导出为 XML ( https://superuser.com/questions/1334495)
- 创建一个文本文件: schtasks.exe /create /RU SYSTEM /TN "Folder\TaskName" /XML "I:\Location\TaskName.xml" 尽可能多的行,每个任务,然后将文件保存为批处理( .bat),以管理员身份运行(右键单击以管理员身份运行)。
- 适用于您想要运行它的计算机。