China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-06-25 04:52
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Ask everyone, how to write a VBS that executes commands in a loop View 2,030 Replies 6
Original Poster Posted 2010-10-20 20:10 ·  中国 山西 长治 联通
新手上路
Credits 10
Posts 10
Joined 2010-01-21 01:30
16-year member
UID 159120
Gender Male
Status Offline
For example:

Start executing a1.bat.

Execute a2 and b1 after 2 hours.

Execute b2 and c1 after another 2 hours.

Execute c2 and a1 after another 2 hours.

Run in this cycle, and do not display the DOS black box.

Please give advice
Floor 2 Posted 2010-10-20 22:33 ·  中国 四川 成都 电信
初级用户
Credits 38
Posts 19
Joined 2007-04-25 22:59
19-year member
UID 86463
Gender Male
Status Offline
abc.vbs

do
CreateObject("WScript.Shell").Run "a1.bat",0
wscript.sleep 7200000
CreateObject("WScript.Shell").Run "a2.bat",0
CreateObject("WScript.Shell").Run "b1.bat",0
wscript.sleep 7200000
CreateObject("WScript.Shell").Run "b2.bat",0
CreateObject("WScript.Shell").Run "c1.bat",0
wscript.sleep 7200000
CreateObject("WScript.Shell").Run "c2.bat",0
loop
Floor 3 Posted 2010-10-21 14:03 ·  中国 四川 成都 电信
初级用户
★★
Credits 176
Posts 78
Joined 2007-04-15 10:53
19-year member
UID 85268
Gender Male
Status Offline
Same as above
Floor 4 Posted 2010-10-21 16:41 ·  中国 山西 长治 联通
新手上路
Credits 10
Posts 10
Joined 2010-01-21 01:30
16-year member
UID 159120
Gender Male
Status Offline
The boss is not working, the script directly shows an error
Floor 5 Posted 2010-10-21 22:22 ·  中国 山西 长治 联通
新手上路
Credits 10
Posts 10
Joined 2010-01-21 01:30
16-year member
UID 159120
Gender Male
Status Offline
Floor 6 Posted 2010-10-27 18:37 ·  中国 广东 东莞 联通
银牌会员
★★★
Credits 1,282
Posts 538
Joined 2002-11-02 00:00
23-year member
UID 129
Gender Male
Status Offline
Originally posted by adslcool at 2010-10-21 04:41 PM:
Boss, it doesn't work. The script directly shows an error


Of course, there will be an error if the object is not defined!
Floor 7 Posted 2010-12-27 20:55 ·  中国 广东 东莞 中移铁通
初级用户
★★
Credits 115
Posts 92
Joined 2010-12-24 16:57
15-year member
UID 179794
Gender Male
Status Offline
Learning
Forum Jump: