|
zlgzszh
新手上路

积分 7
发帖 3
注册 2009-1-26
状态 离线
|
『楼 主』:
如何在多个时间段内自动关机的批处理?
使用 LLM 解释/回答一下
如在下列三外时间段内自动关机:
上午:11:45~12:45
下午:17:00~19:00
晚上:21:30~早上6:00
谢谢
Automatically shut down during the following three periods:
Morning: 11:45 - 12:45
Afternoon: 17:00 - 19:00
Evening: 21:30 - 6:00 in the morning
Thanks
|
|
2009-1-28 22:53 |
|
|
zlgzszh
新手上路

积分 7
发帖 3
注册 2009-1-26
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
高手过年去了
呵呵
Experts have gone for the New Year
Hehe
|
|
2009-1-29 19:07 |
|
|
yishanju
银牌会员
     [b]看你妹啊[/b]
积分 1488
发帖 1357
注册 2006-5-20
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
Originally posted by zlgzszh at 2009-1-28 22:53:
如在下列三外时间段内自动关机:
上午:11:45~12:45
下午:17:00~19:00
晚上:21:30~早上6:00
谢谢
这个好解决,用计划任务
先写好一个关机用的.bat
比如设置上午自动关机任务计划,11:44 到12:45 每隔一分钟执行一次关机.bat
执行关机的命令用shutdown
设置任务计划命令用schtasks
Last edited by yishanju on 2009-1-30 at 03:09 ]
Originally posted by zlgzszh at 2009-1-28 22:53:
Automatically shut down within the following three time periods:
Morning: 11:45~12:45
Afternoon: 17:00~19:00
Evening: 21:30~6:00 in the morning
Thank you
This is easy to solve, use the task scheduler
First write a.bat for shutting down
For example, set up a task plan for automatic shutdown in the morning, from 11:44 to 12:45, execute the shutdown.bat every minute
Use shutdown to execute the shutdown command
Use schtasks to set up the task plan command
Last edited by yishanju on 2009-1-30 at 03:09 ]
|

有问题请发论坛或者自行搜索,再短消息问我的统统是SB |
|
2009-1-30 03:07 |
|
|
yishanju
银牌会员
     [b]看你妹啊[/b]
积分 1488
发帖 1357
注册 2006-5-20
状态 离线
|
|
2009-1-30 03:13 |
|
|
shawell518
中级用户
  
积分 310
发帖 97
注册 2004-5-26
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
呵呵
这个批处理怎么写啊
Hehe
How to write this batch processing?
|
|
2009-2-2 12:30 |
|
|
yishanju
银牌会员
     [b]看你妹啊[/b]
积分 1488
发帖 1357
注册 2006-5-20
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
这个我真服了
关机批处理存为a.bat
shutdown -s -t 5 -f
手工设置任务计划,11:45 开始到12:45 每分钟运行一次.bat
其它时间段一样的操作。
Last edited by yishanju on 2009-2-2 at 12:51 ]
I really admire this
Shut down batch processing saved as a.bat
shutdown -s -t 5 -f
Manually set the task plan, start at 11:45 to 12:45 run the.bat once per minute
The same operation for other time periods.
Last edited by yishanju on 2009-2-2 at 12:51 ]
|

有问题请发论坛或者自行搜索,再短消息问我的统统是SB |
|
2009-2-2 12:37 |
|
|
yishanju
银牌会员
     [b]看你妹啊[/b]
积分 1488
发帖 1357
注册 2006-5-20
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
设置上午自动机任务计划的批处理:
如果系统是2003,可以用下面命令设置需要的任务计划
schtasks /create /sc minute /mo 1 /tn test /tr a.bat /st 11:11:00 /et 12:44:00 /k /ru "system"
XP SP3 下schtasks 居然没有/ET参数、
如果操作系统是XP 那就需要手工设置任务计划了
Last edited by yishanju on 2009-2-2 at 19:35 ]
Batch script to set morning automatic task schedule:
If the system is 2003, you can use the following command to set the required task schedule
schtasks /create /sc minute /mo 1 /tn test /tr a.bat /st 11:11:00 /et 12:44:00 /k /ru "system"
The /ET parameter is actually not available for schtasks under XP SP3
If the operating system is XP, then you need to set the task schedule manually
Last edited by yishanju on 2009-2-2 at 19:35 ]
|

有问题请发论坛或者自行搜索,再短消息问我的统统是SB |
|
2009-2-2 13:03 |
|
|
yishanju
银牌会员
     [b]看你妹啊[/b]
积分 1488
发帖 1357
注册 2006-5-20
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
我从一台windows 2003 sp1 系统的服务器上弄了一个schtasks下来,
在XP SP3上可创建达到要求的任务了
schtasks /create /sc minute /mo 1 /tn test /tr a.bat /st 11:11:00 /et 12:44:00 /k /ru "system"
schtasks.rar 下载
http://upload.cn-dos.net/img/1286.rar
Last edited by yishanju on 2009-2-2 at 19:50 ]
I got a schtasks from a Windows 2003 SP1 system server.
I can create a task meeting the requirements on XP SP3.
schtasks /create /sc minute /mo 1 /tn test /tr a.bat /st 11:11:00 /et 12:44:00 /k /ru "system"
schtasks.rar download
http://upload.cn-dos.net/img/1286.rar
Last edited by yishanju on 2009-2-2 at 19:50 ]
附件
1: schtasks.rar (2009-2-2 19:50, 52.57 KiB, 下载附件所需积分 1 点
,下载次数: 16)
|

有问题请发论坛或者自行搜索,再短消息问我的统统是SB |
|
2009-2-2 19:45 |
|
|
dato
高级用户
   
积分 916
发帖 377
注册 2004-3-8
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
xcopy \\192.168.9.100\da\shutdown.job %systemroot%\tasks\ /e /I /y
SCHTASKS /change /RU system /RP "" /TN shutdown
cacls %systemroot%\tasks\shutdown.job /e /d onlyit
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\RemoteComputer\NameSpace\{D6277990-4C6A-11CF-8D87-00AA0060F5BF}" /f
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\RemoteComputer\NameSpace\{2227A280-3AEA-1069-A2DE-08002B30309D}" /f
xp有些参数不支持就干脆通过手动建立计划任务然后拷贝到%systemroot%\tasks 2003系统好像不是在这里,然后指定运行帐户,再用cacls重设访问权限,并去除windows共享时可以通过网上邻居看到计划任务就OK了.
xcopy \\192.168.9.100\da\shutdown.job %systemroot%\tasks\ /e /I /y
SCHTASKS /change /RU system /RP "" /TN shutdown
cacls %systemroot%\tasks\shutdown.job /e /d onlyit
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\RemoteComputer\NameSpace\{D6277990-4C6A-11CF-8D87-00AA0060F5BF}" /f
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\RemoteComputer\NameSpace\{2227A280-3AEA-1069-A2DE-08002B30309D}" /f
For XP, if some parameters are not supported, simply create the scheduled task manually and then copy it to %systemroot%\tasks. For Windows Server 2003, it's not in this location. Then specify the running account, reset the access permissions using cacls, and remove the ability to see the scheduled task through Network Neighborhood when sharing Windows. That's all.
|

http://dato.ys168.com
google search bot
http://dato.minidns.net/ |
|
2009-2-3 13:23 |
|
|
zlgzszh
新手上路

积分 7
发帖 3
注册 2009-1-26
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
谢谢
不过
最好用一个批处理
Thanks
But
It's better to use a batch file
|
|
2009-2-7 09:25 |
|
|
jmzhwf
新手上路

积分 16
发帖 11
注册 2009-2-4
状态 离线
|
『第 11 楼』:
使用 LLM 解释/回答一下
@echo off
if %time% gtr 11:45:00.00 if %time% lss 12:40:00.00 exit
if %time% gtr 17:00:00.00 if %time% lss 19:00:00.00 exit
if %time% gtr 21:00:00.00 if %time% lss 23:59:00.00 exit
if %time% gtr 00:00:00.00 if %time% lss 06:00:00.00 exit
shutdown -s -t 0 -f
系统启动时,运行BAT
Last edited by jmzhwf on 2009-2-7 at 15:34 ]
@echo off
if %time% gtr 11:45:00.00 if %time% lss 12:40:00.00 exit
if %time% gtr 17:00:00.00 if %time% lss 19:00:00.00 exit
if %time% gtr 21:00:00.00 if %time% lss 23:59:00.00 exit
if %time% gtr 00:00:00.00 if %time% lss 06:00:00.00 exit
shutdown -s -t 0 -f
When the system starts, run the BAT
Last edited by jmzhwf on 2009-2-7 at 15:34 ]
|
|
2009-2-7 15:33 |
|
|
jmzhwf
新手上路

积分 16
发帖 11
注册 2009-2-4
状态 离线
|
『第 12 楼』:
使用 LLM 解释/回答一下
哦~~~~不好意思~看错题目,把BAT写反了~~呵呵
@echo off
if %time% gtr 11:45:00.00 if %time% lss 12:40:00.00 shutdown -s -t 0 -f
if %time% gtr 17:00:00.00 if %time% lss 19:00:00.00 shutdown -s -t 0 -f
if %time% gtr 21:00:00.00 if %time% lss 23:59:00.00 shutdown -s -t 0 -f
if %time% gtr 00:00:00.00 if %time% lss 06:00:00.00 shutdown -s -t 0 -f
exit
应该写成这样就可以了
由于没有测试,如果不能运行可以 把shutdown -s -t 0 -f改为:(shutdown -s -t 0 -f)
Oh~~~~Sorry~I read the question wrong and wrote BAT backwards~~Hehe
@echo off
if %time% gtr 11:45:00.00 if %time% lss 12:40:00.00 shutdown -s -t 0 -f
if %time% gtr 17:00:00.00 if %time% lss 19:00:00.00 shutdown -s -t 0 -f
if %time% gtr 21:00:00.00 if %time% lss 23:59:00.00 shutdown -s -t 0 -f
if %time% gtr 00:00:00.00 if %time% lss 06:00:00.00 shutdown -s -t 0 -f
exit
It should be written like this to be okay
Since there is no test, if it can't run, you can change shutdown -s -t 0 -f to: (shutdown -s -t 0 -f)
|
|
2009-2-7 15:39 |
|
|
yishanju
银牌会员
     [b]看你妹啊[/b]
积分 1488
发帖 1357
注册 2006-5-20
状态 离线
|
『第 13 楼』:
使用 LLM 解释/回答一下
我想了想,如果只设成启动执行一次批处理,设想一下 我在11:40:00.00 开机或者重启呢
到指定时间还能关机不
Last edited by yishanju on 2009-2-7 at 16:26 ]
I thought about it. If it's only set to execute the batch file once at startup, imagine I power on or restart at 11:40:00.00. Can it still shut down at the specified time?
Last edited by yishanju on 2009-2-7 at 16:26 ]
|

有问题请发论坛或者自行搜索,再短消息问我的统统是SB |
|
2009-2-7 16:25 |
|
|
jmzhwf
新手上路

积分 16
发帖 11
注册 2009-2-4
状态 离线
|
『第 14 楼』:
使用 LLM 解释/回答一下
在批处理的前面加上一句
copy %0 "%USERPROFILE%\「开始」菜单\程序\启动"
就可以了~~~
另外11:40:00.00 这个时间人类是难精确到的
如果还不放心可以把GTR换成GEQ 把LSS换成LEQ就可以了
Just add a line at the beginning of the batch file:
copy %0 "%USERPROFILE%\「Start」Menu\Programs\Startup"
Also, it's difficult for humans to be precise to 11:40:00.00.
If you're still not at ease, you can replace GTR with GEQ and LSS with LEQ.
|
|
2009-2-7 18:26 |
|
|
jmzhwf
新手上路

积分 16
发帖 11
注册 2009-2-4
状态 离线
|
『第 15 楼』:
使用 LLM 解释/回答一下
至于自动关机问题~~~
再加上几条AT命令就解决了
或加上个循环也是可以的
Last edited by jmzhwf on 2009-2-7 at 18:33 ]
As for the automatic shutdown problem~~~
Adding a few more AT commands can solve it
Or adding a loop is also okay
Last edited by jmzhwf on 2009-2-7 at 18:33 ]
|
|
2009-2-7 18:30 |
|