|
zouzhxi
中级用户
   蝴蝶之吻
积分 430
发帖 177
注册 2006-9-20 来自 广东深圳
状态 离线
|
『楼 主』:
[请教]如何在批处理中等待被启动的程序结束?
使用 LLM 解释/回答一下
我想问一下,我的这个问题能不能帮我写一个批处理。。。
如下:
我用批处理(tmp_1.bat)打开一个程序后,批处理最小化,程序运行,当我把程序关掉的时候,这个批处理又调用另一个批处里(tmp_2.bat),然后关闭批处理。
我弄了一下,,没成功....
我 的 博 客 ]
————————————俺是分割线——————————————
*********************************
版务记录
*********************************
操作: 更改标题
原因: 原格式不符版规
原标题: 我的这个问题能不能用BAT实现
执行: 3742668
处罚: 初犯,赦之。
备注: 1.建议发贴前看看置顶版规
2.如何更改标题?
点击所发贴右下角的
编辑按钮,然后进行编辑。
3. DOS批處理 & 腳本技術
(批處理室)版规(草稿)
**********************************
Last edited by 3742668 on 2006-9-29 at 09:33 ]
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 ]
附件
1: tmp.JPG (2006-9-28 07:16, 5.36 KiB, 下载附件所需积分 1 点
,下载次数: 6)
|

Butterfly Kiss Blog
计算机DIY联盟论坛 |
|
2006-9-28 07:16 |
|
|
pengfei
银牌会员
    
积分 1218
发帖 485
注册 2006-7-21 来自 湖南.娄底
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
@echo off
***.exe
call tmp_2.bat
...............
pause
@echo off
***.exe
call tmp_2.bat
...............
pause
|
|
2006-9-28 07:34 |
|
|
zouzhxi
中级用户
   蝴蝶之吻
积分 430
发帖 177
注册 2006-9-20 来自 广东深圳
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
还是和我弄的一样,,,,我要的是,在我使用***.EXE时,不执行tmp_2.bat,等我关闭***.EXE后,才执行tmp_2.bat
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
|

Butterfly Kiss Blog
计算机DIY联盟论坛 |
|
2006-9-28 08:13 |
|
|
vkill
金牌会员
     
积分 4103
发帖 1744
注册 2006-1-20 来自 甘肃.临泽
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
:start
tasklist |find "*.exe" &&goto start ||start *.bat &goto :eof
不知道可以否
:
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
|
|
2006-9-28 08:22 |
|
|
pengfei
银牌会员
    
积分 1218
发帖 485
注册 2006-7-21 来自 湖南.娄底
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
在没有使用start打开应用程序情况下, 批处理会等到应用程序结束才执行下一个命令.
@echo off
"c:\Program Files\Tencent\qq\QQ.exe"
echo 学无止境!
pause
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
|
|
2006-9-28 08:35 |
|
|
zouzhxi
中级用户
   蝴蝶之吻
积分 430
发帖 177
注册 2006-9-20 来自 广东深圳
状态 离线
|
|
2006-9-28 08:37 |
|
|
electronixtar
铂金会员
      
积分 7493
发帖 2672
注册 2005-9-2
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
这个问题willsort版主讨论过。Windows程序,被start调用后,不管退出与否,批处理都会继续运行
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.
|

C:\>BLOG http://initiative.yo2.cn/
C:\>hh.exe ntcmds.chm::/ntcmds.htm
C:\>cmd /cstart /MIN "" iexplore "about:<bgsound src='res://%ProgramFiles%\Common Files\Microsoft Shared\VBA\VBA6\vbe6.dll/10/5432'>" |
|
2006-9-28 09:47 |
|
|
namejm
荣誉版主
       batch fan
积分 5226
发帖 1737
注册 2006-3-10 来自 成都
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
start /wait 居然都不行,看来 start 的帮助信息得修改了。
start /wait still doesn't work, it seems the help information for start needs to be revised.
|

尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。 |
|
2006-9-28 10:08 |
|
|
pengfei
银牌会员
    
积分 1218
发帖 485
注册 2006-7-21 来自 湖南.娄底
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
我终于明白楼主为什么执行不成功了. 我发的代码是:
@echo off
"c:\Program Files\Tencent\qq\QQ.exe"
echo 学无止境!
pause
而楼主改为:
@echo off
"c:\Program Files\Tencent\qq\CoralQQ.exe"
echo 学无止境!
pause
要注意: CoralQQ.exe为珊瑚虫外挂, 它只是调用QQ.exe, 当运行CoralQQ.exe它会很快退出. 桌面上出现的是QQ.exe, 而并非CoralQQ.exe.
CoralQQ.exe运行后很快结束, 自然会接着执行下面的命令了!
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!
|
|
2006-9-28 10:24 |
|
|
namejm
荣誉版主
       batch fan
积分 5226
发帖 1737
注册 2006-3-10 来自 成都
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
原来是马甲退出导致的。
It turns out it was caused by the exit of the alternate account.
|

尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。 |
|
2006-9-28 10:49 |
|
|
zouzhxi
中级用户
   蝴蝶之吻
积分 430
发帖 177
注册 2006-9-20 来自 广东深圳
状态 离线
|
『第 11 楼』:
使用 LLM 解释/回答一下
哎...这几天忙的不得了...现在才来逛一下,,,哦..原来 是这样呀..知道了...
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...
|

Butterfly Kiss Blog
计算机DIY联盟论坛 |
|
2006-9-30 07:22 |
|