使用AT命令让Win2K定时执行操作
<br> 在Win2000中,让系统定时操作比较常用的办法就是启动调度服务后使用at命令,调度服务的启动方法可以从服务,MMC中也可以使用命令行的方式"NET START SCHEDULE".<br> <br> at命令的用法如下:<br> <br> AT 命令安排在特定日期和时间运行命令和程序。<br> <br> 要使用 AT 命令,计划服务必须已在运行中。<br> <br> <br> AT [\\computername] [ | /DELETE ]<br> <br> AT [\\computername] time <br> <br> [ /EVERY:date[,...] | /NEXT:date[,...]] "command"<br> <br> <br> \\computername 指定远程计算机。 如果省略这个参数, <br> 会计划在本地计算机上运行命令。 <br> id 指定给已计划命令的识别号。 <br> /delete 删除某个已计划的命令。如果省略 id, <br> 计算机上所有已计划的命令都会被删除。 <br> /yes 不需要进一步确认时,跟删除所有作业 <br> 的命令一起使用。 <br> time 指定运行命令的时间。 <br> /interactive 允许作业在运行时,与当时登录的用户 <br> 桌面进行交互。 <br> /every:date[,...] 每个月或每个星期在指定的日期运行命令。 <br> 如果省略日期,则默认为在每月的本日运行。 <br> /next:date[,...] 指定在下一个指定日期(如,下周四)运行命令。 <br> 如果省略日期,则默认为在每月的本日运行。 <br> "command" 准备运行的 Windows NT 命令或批处理程序。 <br> <br> 用法一,定时启动关闭某个服务 <br> <br> 以RAS服务方例,让该服务在每日19:00启动,次日7:30关闭,AT命令如下:<br> AT 19:00 /every:M,T,W,Th,F,S,Su net start ″remote access server″<br> AT 7:30 /every:M,T,W,Th,F,S,Su net stop ″remote access server″<br> <br> 用法二,定时关机 <br> <br> 1.编写一个批处理文件(使用批处理文件的原因是为了以后更灵活的控制而不需要重新建立调度),内容如下: <br> shutdown /l <br> 如果是让机器重新启动则使用 <br> shutdown /r <br> 文件存为c:\autoshut.bat <br> 2.建立自动执行条目: <br> at 22:00 c:\autoshut.bat <br> <br> 这样每天晚上22:00机器都会自动关机,在关机前会进行30秒钟的提示,倒计时的. <br> <br> 文中用的shutdown程序是win2k的Rkit中自带的,chinaasp网站上好象也有下载,非常好用的. <br> <br> 这是这个程序的其它用法: <br> shutdown [\\computername] ["msg"] [/?] <br> <br> Where: <br> <br> \\computername<br> Remote computer to shut down. If no name is given but the tool is started with any of the other<br> options, the local computer name will be used.<br> /L<br> Specifies a local shutdown.<br> /A<br> Quits a system shutdown. This can only be done during the timeout period. If this switch is used,<br> all others are ignored.<br> /R<br> Restart the computer specifed after shutdown.<br> /T:xx<br> Sets the timer for system shutdown in xx seconds. The default is 20 seconds.<br> "msg"<br> Specifies an additional message with a maximum of 127 characters, surrounded by quotation marks.<br> /y<br> Answers questions with "yes".<br> /C<br> Forces running applications to close.<br> <br> <br> <br> Caution <br> <br> If you use the /c parameter, Windows 2000 ignores the application’s option to save data that<br> might have changed. You will see no File Save dialog box, because Windows 2000 will force the<br> application to close. This will result in a loss of all data not previously saved. <br> <br> /? (or shutdown without parameters)<br> Display help.<br> Examples <br> Shutdown and reboot a remote computer.<br> shutdown \\IMAREMOTECOMPUTER /R <br> Shutdown a local computer, closing all applications in 5 seconds.<br> shutdown /L /C /T:5 <br> <br> PS:shutdown程序下载地址为:http://www.pkufo.com/computer/openfile.asp?id=65<br> <
页:
[1]