![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-08-02 08:00 |
48,037 topics / 350,122 posts / today 0 new / 48,250 members |
| DOS批处理 & 脚本技术(批处理室) » [Ask] How to wait for the started program to end in a batch file? |
| Printable Version 2,140 / 10 |
| Floor1 zouzhxi | Posted 2006-09-28 07:16 |
| 中级用户 Posts 177 Credits 430 From 广东深圳 | |
|
I want to ask, can you help me write a batch script for my this problem...
As follows: After I use the batch script (tmp_1.bat) to open a program, the batch script is minimized, the program runs, when I close the program, this batch script then calls another batch script (tmp_2.bat), and then closes the batch script. I tried it... didn't succeed.... My Blog ] ————————I am the divider line—————————— ********************************* Moderation Record ********************************* Operation: Change title Reason: Original format does not conform to forum rules Original title: Can my this problem be realized with BAT Execution: 3742668 Punishment: First offense, pardon. Remarks: 1. It is suggested to read the sticky forum rules before posting 2. How to change the title? Click the bottom right corner of the posted thread Edit button, then edit. 3. DOS batch processing & script technology (Batch Processing Room) Forum Rules (Draft) ********************************** [ Last edited by 3742668 on 2006-9-29 at 09:33 ] Attachments tmp.JPG (5.36 KiB) |
|
| Floor2 pengfei | Posted 2006-09-28 07:34 |
| 银牌会员 Posts 485 Credits 1,218 From 湖南.娄底 | |
|
@echo off
***.exe call tmp_2.bat ............... pause |
|
| Floor3 zouzhxi | Posted 2006-09-28 08:13 |
| 中级用户 Posts 177 Credits 430 From 广东深圳 | |
|
Still the same as what I did,,,,,What I want is, when I use ***.EXE, don't execute tmp_2.bat, and only execute tmp_2.bat after I close ***.EXE
|
|
| Floor4 vkill | Posted 2006-09-28 08:22 |
| 金牌会员 Posts 1,744 Credits 4,103 From 甘肃.临泽 | |
|
:
The tasklist command is used to list running tasks. The "find "*.exe"" part tries to find processes with the.exe extension. If found, it jumps to the start label. If not found, it starts the *.bat files and then goes to the end of the subroutine. But this might have some issues in terms of proper syntax and functionality in a real Windows command environment. Let's translate the Chinese question "不知道可以否" as "I wonder if this is feasible". So the full translation considering the command and the question is: tasklist |find "*.exe" &&goto start ||start *.bat &goto :eof I wonder if this is feasible |
|
| Floor5 pengfei | Posted 2006-09-28 08:35 |
| 银牌会员 Posts 485 Credits 1,218 From 湖南.娄底 | |
|
When an application is not opened using start, the batch processing will wait until the application finishes before executing the next command.
@echo off "c:\Program Files\Tencent\qq\QQ.exe" echo There is no end to learning! pause |
|
| Floor6 zouzhxi | Posted 2006-09-28 08:37 |
| 中级用户 Posts 177 Credits 430 From 广东深圳 | |
| Floor7 electronixtar | Posted 2006-09-28 09:47 |
| 铂金会员 Posts 2,672 Credits 7,493 | |
|
This issue has been discussed by moderator willsort. For Windows programs called by start, the batch processing will continue to run regardless of whether the program exits or not.
|
|
| Floor8 namejm | Posted 2006-09-28 10:08 |
| 荣誉版主 Posts 1,737 Credits 5,226 From 成都 | |
|
start /wait still doesn't work, it seems the help information for start needs to be revised.
|
|
| Floor9 pengfei | Posted 2006-09-28 10:24 |
| 银牌会员 Posts 485 Credits 1,218 From 湖南.娄底 | |
|
I finally understand why the original poster's execution didn't succeed. The code I sent is:
@echo off "c:\Program Files\Tencent\qq\QQ.exe" echo 学无止境! pause 而 the original poster changed it to: @echo off "c:\Program Files\Tencent\qq\CoralQQ.exe" echo 学无止境! pause Need to note: CoralQQ.exe is the Shanhuhong plug-in, which just calls QQ.exe. When running CoralQQ.exe, it will exit quickly. What appears on the desktop is QQ.exe, not CoralQQ.exe. CoralQQ.exe ends quickly after running, so it will naturally continue to execute the following commands! |
|
| Floor10 namejm | Posted 2006-09-28 10:49 |
| 荣誉版主 Posts 1,737 Credits 5,226 From 成都 | |
|
It turns out it was caused by the exit of the alternate account.
|
|
| Floor11 zouzhxi | Posted 2006-09-30 07:22 |
| 中级用户 Posts 177 Credits 430 From 广东深圳 | |
|
Hey...These past few days have been really busy...Just now I came to take a look,,,Oh..so it is like this呀..Got it...
|
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |