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-20 06:31
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » How to automatically close the command line window View 15,873 Replies 40
Original Poster Posted 2006-07-20 13:25 ·  中国 北京 鹏博士BGP
初级用户
Credits 32
Posts 12
Joined 2006-07-20 13:23
19-year member
UID 58905
Status Offline
After the script finishes running, how can I make the command line window close automatically
Floor 2 Posted 2006-07-20 13:30 ·  中国 湖北 武汉 电信
中级用户
★★
Credits 245
Posts 103
Joined 2006-06-30 00:00
19-year member
UID 57801
Gender Male
Status Offline
Hehe……Just write EXIT at the last sentence of the batch file,
echo off
start d:\123\456.exe If you run a WINDOWS program, use the START command to start it without waiting
exit The command line window automatically closes after the batch script finishes running
Floor 3 Posted 2006-07-20 13:35 ·  中国 北京 鹏博士BGP
初级用户
Credits 32
Posts 12
Joined 2006-07-20 13:23
19-year member
UID 58905
Status Offline
It doesn't work. As soon as I run the script, both the program and the command line window pop up.
Floor 4 Posted 2006-07-20 13:38 ·  中国 北京 鹏博士BGP
初级用户
Credits 32
Posts 12
Joined 2006-07-20 13:23
19-year member
UID 58905
Status Offline
What I mean is to manually run the script to display the program but without showing the command line window. I tried adding exit but it didn't work.
Floor 5 Posted 2006-07-20 13:49 ·  中国 四川 成都 鹏博士宽带
荣誉版主
★★★★
batch fan
Credits 5,226
Posts 1,737
Joined 2006-03-10 00:38
20-year member
UID 51697
From 成都
Status Offline
"However, it is not in the form of a command line window" How to understand this sentence? If you can't even describe it clearly yourself, how can you let others answer?
Floor 6 Posted 2006-07-20 13:55 ·  中国 北京 鹏博士BGP
初级用户
Credits 32
Posts 12
Joined 2006-07-20 13:23
19-year member
UID 58905
Status Offline
A script to run a player. After clicking, the player runs and the command line window is displayed. Can the command line window not be displayed while the program is running?
Floor 7 Posted 2006-07-20 14:26 ·  中国 上海 松江区 电信
铂金会员
★★★★
DOS一根葱
Credits 5,493
Posts 2,315
Joined 2006-05-01 10:41
20-year member
UID 54766
Gender Male
From 上海
Status Offline
Post the script.
Floor 8 Posted 2006-07-20 14:34 ·  中国 北京 鹏博士BGP
初级用户
Credits 32
Posts 12
Joined 2006-07-20 13:23
19-year member
UID 58905
Status Offline
1.bat

d:
cd D:\Program Files\Ringz Studio\Storm Codec
mplayerc.exe -play -add D:\TDdownload\1.asf

Every time I double-click to run 1.bat, both the player and the command line window pop up
Floor 9 Posted 2006-07-20 14:35 ·  中国 北京 鹏博士BGP
初级用户
Credits 32
Posts 12
Joined 2006-07-20 13:23
19-year member
UID 58905
Status Offline
My system is XP
Floor 10 Posted 2006-07-20 14:52 ·  中国 四川 成都 鹏博士宽带
荣誉版主
★★★★
batch fan
Credits 5,226
Posts 1,737
Joined 2006-03-10 00:38
20-year member
UID 51697
From 成都
Status Offline
Oh, it turns out it's Storm Video. I don't have it installed on my computer and don't want to install it. I've heard there are tons of plugins.

This is because Storm Video was called to open a video and audio file, so the CMD window won't close until Storm Video is closed. If you don't want to automatically open a certain video and audio file, change mplayerc.exe -play -add D:\TDdownload\1.asf to start mplayerc.exe, then the CMD window can close after starting Storm Video, and then you can manually open the specified video and audio file.
Floor 11 Posted 2006-07-20 15:15 ·  中国 北京 鹏博士BGP
初级用户
Credits 32
Posts 12
Joined 2006-07-20 13:23
19-year member
UID 58905
Status Offline
Expert! You added "start" before "mplayerc.exe -play -add D:\TDdownload\1.asf", and when you click to run it, the command line window doesn't show up because the "start" command in Windows is used to start a separate process in the background without displaying the command prompt window.
Floor 12 Posted 2006-07-20 15:31 ·  中国 四川 成都 鹏博士宽带
荣誉版主
★★★★
batch fan
Credits 5,226
Posts 1,737
Joined 2006-03-10 00:38
20-year member
UID 51697
From 成都
Status Offline
I can't clearly explain the specific reason. According to my habit, if I call an external program and don't want to wait for the external program to exit to perform the next operation, I add "start" in front.

Looking forward to experts' in-depth theoretical analysis. Hehe.
Floor 13 Posted 2006-07-20 16:53 ·  中国 北京 鹏博士BGP
初级用户
Credits 32
Posts 12
Joined 2006-07-20 13:23
19-year member
UID 58905
Status Offline
hehe Still, thank you very much
Floor 14 Posted 2006-07-20 17:18 ·  中国 广西 玉林 博白县 电信
金牌会员
★★★★
Credits 3,687
Posts 1,467
Joined 2005-08-08 12:00
20-year member
UID 44210
Status Offline
start: Run the specified program or command in another window. The batch processing in the current window continues to run without waiting for the other window to finish running
Floor 15 Posted 2006-07-20 18:53 ·  中国 广东 广州 天河区 电信
中级用户
★★
Credits 466
Posts 237
Joined 2005-10-12 20:53
20-year member
UID 43413
Status Offline
If it's about using Baofeng Video Player to open a video, there's no need to use batch processing. Creating a shortcut is easier. This shortcut only needs one command: "D:\Program Files\Ringz Studio\Storm Codec\mplayerc.exe" -play -add D:\TDdownload\1.asf
Forum Jump: