windows - 如何以编程方式停止/启动远程计算机上的计划任务?

标签 windows scheduled-tasks

我想编写一个脚本来停止远程计算机上的计划任务,执行一些操作,然后重新启动计划任务。

我该怎么做?

最佳答案

这是我发现的。

停止:

schtasks /end /s <machine name> /tn <task name>

开始:

schtasks /run /s <machine name> /tn <task name>


C:\>schtasks /?

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 /?

关于windows - 如何以编程方式停止/启动远程计算机上的计划任务?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/290559/

相关文章:

JAVA ScheduledExecutorService 仅在调用 Task<V> 时运行一次

c# - 调试日志弄乱了我的代码

python - 直接在windows上使用GDAL

windows - 为什么 PowerShell 无法识别带引号的参数?

c++ - 如何更改 Excel DSN 的默认工作簿?

windows - 如何在 Apache 中设置 mod_lua 以访问第三方 Lua 模块?

task - 从任务服务器运行的查询找不到文档?

javascript - 如何在 Angular 中安排任务

parse-platform - 为 parse.com 后台作业实现超过一天的重复间隔

java - 在JAVA循环中每x秒使用不同参数执行一个方法