荔园在线

荔园之美,在春之萌芽,在夏之绽放,在秋之收获,在冬之沉淀

[回到开始] [上一篇][下一篇]


发信人: netlife (漂游), 信区: Microsoft
标  题: [转载] 使用AT命令让Win2K定时执行操作(转寄)
发信站: 荔园晨风BBS站 (Sat Sep  8 06:18:23 2001), 转信

【 以下文字转载自 netlife 的信箱 】
【 原文由 netlife.bbs@bbs.pku.edu.cn 所发表 】
发信人: laofuzihere (老夫子◎偶土故偶在), 信区: Software
标  题: 使用AT命令让Win2K定时执行操作
发信站: 北大未名站 (2001年09月07日20:44:32 星期五), 站内信件

使用AT命令让Win2K定时执行操作

时间:2001/08/30 10:32 作者:沧海笑一声 中文NT资源网



 在Win2000中,让系统定时操作比较常用的办法就是启动调度服务后使用at命令,调度服
务的启动方法可以从服务,MMC中也可以使用命令行的方式"NET START SCHEDULE". at命
令的用法如下:

AT 命令安排在特定日期和时间运行命令和程序。

要使用 AT 命令,计划服务必须已在运行中。



AT [\\computername] [ [id] [/DELETE] | /DELETE [/YES]]

AT [\\computername] time [/INTERACTIVE]

[ /EVERY:date[,...] | /NEXT:date[,...]] "command"


\\computername 指定远程计算机。 如果省略这个参数,
会计划在本地计算机上运行命令。
id 指定给已计划命令的识别号。
/delete 删除某个已计划的命令。如果省略 id,
计算机上所有已计划的命令都会被删除。
/yes 不需要进一步确认时,跟删除所有作业
的命令一起使用。
time 指定运行命令的时间。
/interactive 允许作业在运行时,与当时登录的用户
桌面进行交互。
/every:date[,...] 每个月或每个星期在指定的日期运行命令。
如果省略日期,则默认为在每月的本日运行。
/next:date[,...] 指定在下一个指定日期(如,下周四)运行命令。
如果省略日期,则默认为在每月的本日运行。
"command" 准备运行的 Windows NT 命令或批处理程序。

用法一,定时启动关闭某个服务

以RAS服务方例,让该服务在每日19:00启动,次日7:30关闭,AT命令如下:
AT 19:00 /every:M,T,W,Th,F,S,Su net start ″remote access server″
AT 7:30 /every:M,T,W,Th,F,S,Su net stop ″remote access server″

用法二,定时关机

1.编写一个批处理文件(使用批处理文件的原因是为了以后更灵活的控制而不需要重新建
立调度),内容如下:
shutdown /l
如果是让机器重新启动则使用
shutdown /r
文件存为c:\autoshut.bat
2.建立自动执行条目:
at 22:00 c:\autoshut.bat

这样每天晚上22:00机器都会自动关机,在关机前会进行30秒钟的提示,倒计时的.

文中用的shutdown程序是win2k的Rkit中自带的,chinaasp网站上好象也有下载,非常好用
的.

这是这个程序的其它用法:
shutdown [\\computername] [/l] [/a] [/r] [/t:xx] ["msg"] [/y] [/c] [/?]

Where:

\\computername
Remote computer to shut down. If no name is given but the tool is started
with any of the other
options, the local computer name will be used.
/L
Specifies a local shutdown.
/A
Quits a system shutdown. This can only be done during the timeout period.
If this switch is used,
all others are ignored.
/R
Restart the computer specifed after shutdown.
/T:xx
Sets the timer for system shutdown in xx seconds. The default is 20
seconds.
"msg"
Specifies an additional message with a maximum of 127 characters,
surrounded by quotation marks.
/y
Answers questions with "yes".
/C
Forces running applications to close.



Caution

If you use the /c parameter, Windows 2000 ignores the application’s option
to save data that
might have changed. You will see no File Save dialog box, because Windows
2000 will force the
application to close. This will result in a loss of all data not previously
saved.

/? (or shutdown without parameters)
Display help.
Examples
Shutdown and reboot a remote computer.
shutdown \\IMAREMOTECOMPUTER /R
Shutdown a local computer, closing all applications in 5 seconds.
shutdown /L /C /T:5



--
欢迎光临★Software★版!

※ 来源:·北大未名站 bbs.pku.edu.cn·[FROM: 162.105.90.55]
--
※ 转寄:·北大未名站 bbs.pku.edu.cn·[FROM: 210.39.3.50]
--
※ 转载:·荔园晨风BBS站 bbs.szu.edu.cn·[FROM: 192.168.48.13]


[回到开始] [上一篇][下一篇]

荔园在线首页 友情链接:深圳大学 深大招生 荔园晨风BBS S-Term软件 网络书店