windows 如何使用命令提示符安排任务?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5104246/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 16:15:54  来源:igfitidea点击:

How to schedule a task with the command prompt?

windowswindows-server-2003scheduled-tasks

提问by Aidiakapi

I want to know how to schedule a task using the command prompt. Now I know you can probably find this on the internet, but I haven't found what I've been looking for.

我想知道如何使用命令提示符安排任务。现在我知道你可能可以在互联网上找到这个,但我还没有找到我一直在寻找的东西。

The problem is that the operating system I have to do it on is in Swedish (Windows Server 2003 in Swedish).

问题是我必须使用的操作系统是瑞典语(瑞典语为 Windows Server 2003)。

It needs to run a program located at: 'C:\Documents and Setting\Administrat?r\Skrivbord\Midnight.exe'.

它需要运行位于以下位置的程序:“C:\Documents and Setting\Administrat?r\Skrivbord\Midnight.exe”。

It should run around midnight, every day.

它应该每天午夜运行。

Does anybody know how to schedule this in cmd?
I do have administrator rights, so privileges shouldn't be a problem.

有人知道如何在cmd中安排这个吗?
我确实有管理员权限,所以权限应该不是问题。

回答by jujule

Just use schtasks windows utility in a .bat file or manually in CMD :

只需在 .bat 文件中或在 CMD 中手动使用 schtasks windows 实用程序:

schtasks /create /ru Admin /rp paswd /tn "daily work" /tr "C:\Documents and Setting\Administrat?r\Skrivbord\Midnight.exe" /sc daily /st 23:55:00 

Swedish should'nt be a special case :)

瑞典语不应该是一个特例:)

off course /ruis the username which we'll be used to run the task

off course/ru是我们将用于运行任务的用户名

回答by AlexC

You want the AT command to put an entry in the scheduler service TechNet on AT

您希望 AT 命令在 AT 上的调度程序服务TechNet 中放置一个条目