如何通过命令行启动 Windows 调度程序?

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

How to launch Windows Scheduler by command-line?

windowscommand-linescheduler

提问by

I mean to open the built-in Windows GUI from command line- not to launch by Schtasks

我的意思是从命令行打开内置的 Windows GUI - 不要通过 Schtasks 启动

回答by Andy White

taskschd.mscis available in Windows Vista and later.

taskschd.msc在 Windows Vista 和更高版本中可用。

http://technet.microsoft.com/en-us/library/cc721871.aspx

http://technet.microsoft.com/en-us/library/cc721871.aspx

I could have sworn I'd seen a little task scheduler GUI like you're talking about prior to Vista, but maybe I was thinking of the "Add Scheduled Task" wizard.

我可以发誓我见过像您在 Vista 之前所说的那样的小任务调度程序 GUI,但也许我正在考虑“添加调度任务”向导。

You might have to settle for opening the scheduled tasks explorer with this command:

您可能不得不接受使用以下命令打开计划任务资源管理器:

control schedtasks

I couldn't find any way to launch the "Add Scheduled Task" wizard from the command line, unfortunately (there has to be a way!)

不幸的是,我找不到任何从命令行启动“添加计划任务”向导的方法(必须有办法!)

回答by Rhak Kahr

I'm using Windows 2003 on the server. I'm in action with "SCHTASKS.EXE"

我在服务器上使用 Windows 2003。我正在使用“SCHTASKS.EXE”

    SCHTASKS /parameter [arguments]

    Description:
        Enables an administrator to create, delete, query, change, run and
        end scheduled tasks on a local or remote system. Replaces AT.exe.

    Parameter List:
        /Create         Creates a new scheduled task.

        /Delete         Deletes the scheduled task(s).

        /Query          Displays all scheduled tasks.

        /Change         Changes the properties of scheduled task.

        /Run            Runs the scheduled task immediately.

        /End            Stops the currently running scheduled task.

        /?              Displays this help message.

    Examples:
        SCHTASKS
        SCHTASKS /?
        SCHTASKS /Run /?
        SCHTASKS /End /?
        SCHTASKS /Create /?
        SCHTASKS /Delete /?
        SCHTASKS /Query  /?
        SCHTASKS /Change /?

    ┌─────────────────────────────────────┐
    │ Executed Wed 02/29/2012 10:48:36.65 │
    └─────────────────────────────────────┘

It's quite interesting and makes me feel so powerful. :)

这很有趣,让我觉得自己很强大。:)

回答by TheSoftwareJedi

This launches the Scheduled Tasks MMC Control Panel:

这将启动计划任务 MMC 控制面板:

%SystemRoot%\system32\taskschd.msc /s

Older versions of windows had a splash screen for the MMC control panel and the /s switch would supress it. It's not needed but doesn't hurt either.

旧版本的 Windows 有一个用于 MMC 控制面板的闪屏,/s 开关会抑制它。它不是必需的,但也不会受到伤害。

回答by wayneseymour

Here is an example I just used:

这是我刚刚使用的一个示例:

at 8am /EVERY:M,T,W,Th,F,S,Su cmd /c c:\myapp.exe

The result was:

结果是:

Added a new job with job ID = 1

Then, to check my work:

然后,检查我的工作:

at

回答by KAE

Yes, the GUI is available in XP. I can get the list of scheduled tasks (but not the GUI) to open with the following command,

是的,GUI 在 XP 中可用。我可以使用以下命令打开计划任务列表(但不是 GUI),

control.exe  schedtasks

Then you can use the wizard to add a new scheduled task, for example.

然后,您可以使用该向导添加新的计划任务,例如。

In XP, you can find the Scheduler GUI from within Windows Help if you search for "Scheduled Tasks" then click on "Step by Step instructions" and open the scheduler GUI. Clicking on the last link executes the following command, which likely could be translatedinto something that would open the Scheduler GUI from the command line. Does anyone know how?

在 XP 中,如果您搜索“计划任务”,然后单击“分步说明”并打开计划程序 GUI,则可以从 Windows 帮助中找到计划程序 GUI。单击最后一个链接会执行以下命令,该命令可能会转换为可以从命令行打开调度程序 GUI 的内容。有谁知道怎么做?

ms-its:C:\WINDOWS\Help\mstask.chm::/EXEC=,control.exe, schedtasks CHM=ntshared.chm FILE=alt_url_windows_component.htm

回答by Mahendra

You might want to have look at simple command line scheduler "at":

你可能想看看简单的命令行调度程序“at”:



C:\Documents and Settings\mahendra.patil>at/?

The AT command schedules commands and programs to run on a computer at a specified time and date. The Schedule service must be running to use the AT command.

AT 命令安排命令和程序在指定的时间和日期在计算机上运行。计划服务必须正在运行才能使用 AT 命令。

AT [\computername] [ [id] [/DELETE] | /DELETE [/YES]]
AT [\computername] time [/INTERACTIVE]
    [ /EVERY:date[,...] | /NEXT:date[,...]] "command"

\computername Specifies a remote computer. Commands are scheduled on the local computer if this parameter is omitted.

\computername 指定远程计算机。如果省略此参数,则在本地计算机上调度命令。

id Is an identification number assigned to a scheduled command.

id 是分配给预定命令的标识号。

/delete Cancels a scheduled command. If id is omitted, all the scheduled commands on the computer are canceled.

/delete 取消预定的命令。如果省略 id,则取消计算机上所有已调度的命令。

/yes Used with cancel all jobs command when no further confirmation is desired.

/yes 当不需要进一步确认时,与取消所有作业命令一起使用。

time Specifies the time when command is to run.

time 指定命令运行的时间。

/interactive Allows the job to interact with the desktop of the user who is logged on at the time the job runs.

/interactive 允许作业与在作业运行时登录的用户的桌面进行交互。

/every:date[,...] Runs the command on each specified day(s) of the week or month. If date is omitted, the current day of the month is assumed.

/every:date[,...] 在每周或每月的每个指定日期运行命令。如果省略日期,则假定为当月的当前日期。

/next:date[,...] Runs the specified command on the next occurrence of the day (for example, next Thursday). If date is omitted, the current day of the month is assumed.

/next:date[,...] 在当天的下一次出现时(例如,下周四)运行指定的命令。如果省略日期,则假定为当月的当前日期。

"command" Is the Windows NT command, or batch program to be run.

“命令”是 Windows NT 命令,或要运行的批处理程序。

回答by Jeremy Bradshaw

You can make a new shortcut to:

您可以创建一个新的快捷方式:

control schedtasks

Name it something easy like "tsks.lnk" and then save it in c:\windows\system32.

将其命名为“tsks.lnk”之类的简单名称,然后将其保存在 c:\windows\system32 中。

You can now press Windows Key+ R, then type "tsks" and press Enterand voila. No mouse necessary at that point.
Or in Windows Vista/7/2008, just press Windows Key, then type "tsks" and press Enter.

您现在可以按Windows Key+ R,然后键入“tsks”并按Enter,瞧。那时不需要鼠标。
或者在 Windows Vista/7/2008 中,只需按Windows Key,然后键入“tsks”并按Enter

回答by AmThreat

You can use either TASKSCHD.MSCor CONTROL SCHEDTASKS

您可以使用TASKSCHD.MSCCONTROL SCHEDTASKS

Hereare some more such commands.

这里还有一些这样的命令。

回答by RodneyL

I'm also running XP SP2, and this works perfectly (from the command line...):

我也在运行 XP SP2,这很好用(从命令行...):

start control schedtasks

回答by Anonymous

If you're asking what I think you're asking, you can open it by executing this:

如果你问我认为你在问什么,你可以通过执行以下命令打开它:

explorer.exe "C:\WINDOWS\Tasks\"