用批处理写了个在指定时间段内关机的程序
用批处理写了个在指定时间段内关机的程序因为 windows xp 的 SHELL 程序已经增强啦 批处理的功能。
象是用 IF
可以对数字进行大小比较。 但是时间怎么比较呢? 看起来有点难度,其实也不难的。 看看我写的批处理。开机一执行这个批处理,
在早上 6:00 到 晚上
21:30 分内 不执行关机操作。 可以正常使用电脑
在晚上 21:30 到 早上 6:00 分内进行关机操作。
因为这个时间段,人通常是要睡觉啦!所以在这个时间段内一开机就会马上关机的。
***@echo off
if %time% lss
00:00: goto 0_9 rem 0点
if %time% gtr 23:59: goto 0_9 rem
3点至9点
if %time% gtr 09:59:59:99 goto if1 rem 1点
if %time% gtr
19:59:59:99 goto if2 rem 2点
goto 10_23 :if1
if %time% lss
10:00:00:00 goto 0_9
goto 10_23:if2
if %time% lss 20:00:00:00 goto
0_9
goto 10_23:0_9
if %time% lss 6:00:00:00 goto exec
goto
end:10_23
if %time% gtr 21:30:00:00 goto exec
goto
end
:exec
call shutdown /s /t 00
:end
exit还可以用 windows xp
的那个计划任务程序。SCHTASKS 来创建一个每天在 21:31 执行这个批
用批处理写了个在指定时间段内关机的程序 来自淘豆网www.taodocs.com转载请标明出处.