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-30 02:54
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Solved] How to run two auto-execution batch files simultaneously? View 3,723 Replies 11
Original Poster Posted 2005-09-08 12:13 ·  中国 山东 威海 联通
新手上路
Credits 7
Posts 2
Joined 2005-09-08 12:08
20-year member
UID 42341
Status Offline
How to write an automatic batch file to execute two already compiled batch files
Floor 2 Posted 2005-09-08 20:20 ·  中国 广西 梧州 电信
初级用户
Credits 46
Posts 15
Joined 2005-08-13 12:11
20-year member
UID 41615
Status Offline
Floor 3 Posted 2005-09-08 21:04 ·  中国 广东 广州 海珠区 电信
金牌会员
★★★★
D◎$ Fαп
Credits 4,562
Posts 1,883
Joined 2004-01-19 00:00
22-year member
UID 15812
Gender Male
From 广东广州
Status Offline
call a.bat
call b.bat
----====≡≡≡≡ 我的至爱,永远是MSDOS!≡≡≡≡====----
Floor 4 Posted 2005-09-22 19:22 ·  中国 山西 运城 中移铁通
元老会员
★★★★
Batchinger
Credits 4,432
Posts 1,512
Joined 2002-10-18 00:00
23-year member
UID 19
Gender Male
Status Offline
Re JonePeng:

This is executed one after another, not "simultaneously"; but I guess the "simultaneously" the original poster mentioned is this kind of simultaneous. To achieve approximate simultaneous execution, you must call programs in a multitasking environment. Therefore, in a pure DOS environment (meaning without loading any extension programs), it is impossible to achieve.

And under Windows, you can use start to call batch files to achieve polling-style "simultaneous" execution. I did some tests under XP, which is very interesting. Anyone who is interested can also test it and discuss the reason.

After downloading the attachment test.rar and extracting it, execute sp.bat in it, and then observe the execution result.
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
+1 2010-07-23 12:11
Attachments
MultiTaskTest.rar (232 bytes, Credits to download 1 pts, Downloads: 225)
※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得!
Floor 5 Posted 2005-09-28 07:25 ·  中国 山东 威海 联通
新手上路
Credits 7
Posts 2
Joined 2005-09-08 12:08
20-year member
UID 42341
Status Offline
Thank you,各位 masters, for your help
Floor 6 Posted 2005-10-17 17:34 ·  中国 福建 三明 电信
中级用户
★★
Credits 316
Posts 83
Joined 2005-03-01 00:00
21-year member
UID 36626
Gender Male
Status Offline
D:\MultiTaskTest>sp.bat
5
start 1...
start 2...
start 3...
start 4...

D:\MultiTaskTest>end 2.

D:\MultiTaskTest>end 4.

D:\MultiTaskTest>
D:\MultiTaskTest>end 1.

D:\MultiTaskTest>
D:\MultiTaskTest>end 3.

D:\MultiTaskTest>
D:\MultiTaskTest>
D:\MultiTaskTest>
D:\MultiTaskTest>exit
exit
exit
exit




Puzzled
Floor 7 Posted 2005-10-17 17:42 ·  中国 福建 三明 电信
中级用户
★★
Credits 316
Posts 83
Joined 2005-03-01 00:00
21-year member
UID 36626
Gender Male
Status Offline
Remove the pause>nul inside. It's like this again.

D:\MultiTaskTest>sp.bat
5

D:\MultiTaskTest>start 1...
end 1.
start 2...

D:\MultiTaskTest>end 2.

D:\MultiTaskTest>start 3...
end 3.
start 4...

D:\MultiTaskTest>end 4.

D:\MultiTaskTest>

It seems that without removing pause>nul, batches 1-4 seem to execute simultaneously again.
Floor 8 Posted 2005-10-17 17:47 ·  中国 福建 三明 电信
中级用户
★★
Credits 316
Posts 83
Joined 2005-03-01 00:00
21-year member
UID 36626
Gender Male
Status Offline
Realize polling-style "simultaneous" execution??
Floor 9 Posted 2005-10-18 10:23 ·  中国 广东 深圳 联通
初级用户
Credits 94
Posts 9
Joined 2005-07-17 17:37
20-year member
UID 40811
Status Offline
Of course, it's easy under WINDOWS. If it's under DOS, it's also feasible. But this requires using TSR technology.
Floor 10 Posted 2008-10-12 22:56 ·  马来西亚
新手上路
Credits 2
Posts 1
Joined 2008-10-12 22:09
17-year member
UID 128202
Gender Male
Status Offline
Haha, it's fun. I also want to play~~~
Floor 11 Posted 2008-10-26 09:56 ·  中国 湖南 常德 电信
新手上路
Credits 1
Posts 1
Joined 2008-10-17 18:57
17-year member
UID 128604
Gender Male
Status Offline
Study study study study study study
Floor 12 Posted 2008-11-20 16:49 ·  IANA 局域网IP(Private-Use)
新手上路
Credits 2
Posts 1
Joined 2008-11-20 16:21
17-year member
UID 131564
Gender Male
Status Offline
Remove the pause>nul inside. Still like this.

D:\MultiTaskTest>sp.bat
5

D:\MultiTaskTest>start 1...
end 1.
start 2...

D:\MultiTaskTest>end 2.

D:\MultiTaskTest>start 3...
end 3.
start 4...

D:\MultiTaskTest>end 4.

D:\MultiTaskTest>

It seems that without removing pause>nul, batch processing 1-4 seem to execute simultaneously again.
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
snowing119 +1 2009-12-07 16:49
Forum Jump: