求vbs或bat指定某个时间段运行某个程序

[复制链接]
查看11 | 回复3 | 2011-4-19 11:17:47 | 显示全部楼层 |阅读模式
最好能指定时间段内循环脚本,超出指定时间段不循环.比如22:30至7:30时间段内运行程序.
回复

使用道具 举报

千问 | 2011-4-19 11:17:47 | 显示全部楼层
<pre id=\"best-answer-content\" class=\"reply-text mb10\">@echo off
rem 该批处理放在启动中即可
if %time:~0,5% geq 22:30 if %time:~0,5% leq 23:59 start \"\" \"c:\\hello.exe\"
rem 22:30-23:59之间启动\"c:\\hello.exe\"
if %time:~0,5% geq 0:00 if %time:~0,5% leq 7:30 start \"\" \"c:\\hello.exe\"
rem 0:00-7:30之间启动\"c:\\hello.exe\"

















<h4 class=\"ask\">追问





<pre class=\"replyask-text\" id=\"content-4740309\">你这个好像不循环.我要是在22:29前运行的机子,网吧的机器只要不重启..就不会执行脚本了.~我要的是22:30到7:30分之间脚本才运行.有无办法?
回复

使用道具 举报

千问 | 2011-4-19 11:17:47 | 显示全部楼层
<pre class=\"replyask-text\" id=\"content-4764202\">@echo off
rem 该批处理放在启动中即可
if %time:~0,5% geq 22:30 if %time:~0,5% leq 23:59 goto :hello
rem 22:30-23:59之间启动\"c:\\hello.exe\"
if %time:~0,5% geq 0:00 if %time:~0,5% leq 7:30 goto :hello
rem 0:00-7:30之间启动\"c:\\hello.exe\"
exit
:hello
start \"\" \"c:\\hello.exe\"
goto hello

rem 实现无限循环了,如果不在22:30-7:30之间就会自动退出
回复

使用道具 举报

千问 | 2011-4-19 11:17:47 | 显示全部楼层
<pre class=\"replyask-text\" id=\"content-4739494\">你这个回答,貌似照搬别人的吧.这个我找到不过,不是我想要的结果.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行