zoukankan      html  css  js  c++  java
  • [转载]schtasks命令使用实例介绍

      原文出处:http://www.dzwebs.net/2969.html

      schtasks命令,用途广泛,使用高效,不仅能为本地计算机添加任务计划,而且还能通过某台计算机的操作,运行另外一台计算机的程序。可定时、定日、定月、定周、定年等让本机或局域网电脑启动软件。

      下面,是schtasks命令的常用的实例介绍,希望对您有所帮助。

      一、schtasks命令的相关属性查询方法

      查看计划任务

      schtasks
      schtasks /query

      视图模式详细信息

      schtasks /query /v
      schtasks /query /v /fo list

      逗号分隔列表

      schtasks /query /v /fo csv

         逗号分隔列表,不显示标题

      schtasks /query /v /fo csv /nh
      schtasks /query /v /fo /nh
      schtasks /query /v /fo csv /nh
      C:\>schtasks /query /s 169.254.100.225 /u administrator /p windows
      INFO: There are no scheduled tasks present in the system.

      二、schtasks命令定时运行程序的实例介绍

      每24小时

      schtasks /create /tn Mytask /tr notepad.exe /sc hourly /ru zly /rp windows

       指定每12小时

      schtasks /create /tn mytask /tr notepad.exe /sc hourly /ru zly /rp windows /mo 12
      schtasks /create /tn mytask /tr write.exe /sc hourly /ru zly /rp windows /mo 23 /sd 2008/09/09 /ed 2009/09/09 /st 20:00:00
      C:\>schtasks /create /tn Mytask /tr notepad.exe /sc hourly /mo 12 /st 08:00:00 /
      sd 2007/07/07 /ed 2007/08/09 /ru zly /rp windows
      SUCCESS: The scheduled task "Mytask" has successfully been created.
      C:\>schtasks /delete /tn Mytask /f
      SUCCESS: The scheduled task "Mytask" was successfully deleted.

       每30

      C:\>schtasks /create /tn Mytask /tr mmc.exe /sc daily /mo 30 /sd 2007/02/28 /ed
      2007/12/31 /st 20:00:00 /ru zly /rp windows

       每30个周

      C:\>schtasks /create /s 169.254.100.225 /u administrator /p windows /tn RemoteTe
      st /tr notepad.exe /sc weekly /mo 30 /ru administrator /rp windows
      SUCCESS: The scheduled task "RemoteTest" has successfully been created.

       每50个周

      C:\>schtasks /create /tn Mytask /tr "%systemdrive%\internet explorer\iexplore.ex
      e" /sc weekly /mo 50 /sd 2007/08/09 /ed 2007/08/10 /ru zly /rp windows

       任务在指定的日期和时间运行一次

      C:\>schtasks /create /tn Mytask /tr notepad.exe /sc once /st 20:00:00 /sd 2007/9/09 /ru zly /rp windows

       任务在每次系统启动的时候

      C:\>schtasks /create /tn Mytask /tr notepad.exe /sc onstart /ru zly /rp windows

       每当用户(任意用户)登录的时候

      C:\>schtasks /create /tn Mytask /tr notepad.exe /sc onlogon /ru zly /rp windows

       在空闲的10分钟时候运行一个屏保称序。

      C:\>schtasks /create /tn Mytask /tr "%windir%\system32\logon.scr /s" /sc onidle /i 10 /ru zly /rp windows

       把上面的scheduled---改变一个任务的称序和账户(administrator

      C:\>schtasks /change /tn Mytask /tr write.exe /ru administrator /rp xxxxxx

       改变一个任务称序和账户(system)注意受限账户既便更改到system账户任务也无法运行,请参阅组策略-用户的权利分配。只有administrators组(默认)

      C:\schtasks /change /tn Mytask /tr write.exe /ru system

      运行一个任务

      C:\schtasks /run /tn Mytask

       结束一个任务

      C:\schtasks /end /tn Mytask

       删除全部的任务

      C:\schtasks /delete /tn * /f

       立即运行和终止远程计划任务

      C:\>schtasks /run /s 169.254.100.225 /u administrator /p windows /tn remotetest
      SUCCESS: Attempted to run the scheduled task "remotetest".
    
      C:\>schtasks /end /s 169.254.100.225 /u administrator /p windows /tn remotetest
      SUCCESS: The scheduled task "remotetest" has been terminated successfully.

       忘了空密码默认无法运行计划任务,想空密码运行计划任务,gpedit.msc-本地策略-安全设置-使用空白密码的本地帐户只允许进行控制台登录禁用。启用禁用如果不设密码可能会带来安全隐患。

  • 相关阅读:
    win8 需要管理员权限才能删除此应用程序
    windows 8 解决端口(COM和LPT)问题:Prolific USBtoSerial Comm Port(COM4)驱动异常的问题
    sqlite 获取数据库中的所有表
    ListView simpleAdapter的基本使用
    一根长度为133米的材料需要截成长度为19米和23米的短料,求两种短料各截多少根时剩余的材料最少?
    打印输出九九乘法表
    写一个函数,输入一个十六进制,输出相应的十进制数。
    求3100的素数!
    从键盘输入若干个同学的成绩,统计并输出最高成绩 最低成绩 平均分,当输入负数时结束输入
    编写两个函数,分别求由键盘输入两个整数的最大公约数和最小公倍数。用主函数调用这两个函数,并输出结果
  • 原文地址:https://www.cnblogs.com/microfan/p/3135704.html
Copyright © 2011-2022 走看看