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-08-01 15:54
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » The window of the BAT file will automatically close. View 2,313 Replies 6
Original Poster Posted 2006-03-24 11:15 ·  中国 广东 深圳 宝安区 电信
初级用户
Credits 60
Posts 14
Joined 2006-03-23 09:28
20-year member
UID 52635
Status Offline
For example:

In the BAT statement, we only have such a sentence:

NOTEPAD AA.TXT

After running, the BAT window will not disappear until you close the notepad, and then the BAT window will close.

What I want to do is how to make the BAT file window automatically close as soon as NOTEPAD is opened.

I have tried using CALL or START to call NOTEPAD.EXE, but it doesn't work.
Floor 2 Posted 2006-03-24 12:36 ·  中国 河北 石家庄 联通
铂金会员
★★★★
网络独行侠
Credits 6,962
Posts 2,753
Joined 2003-04-16 00:00
23-year member
UID 1565
Gender Male
From 河北保定
Status Offline
It's okay to use start. It was tested successfully under 2003. The content is as follows:

@echo off
start notepad.exe
偶只喜欢回答那些标题和描述都很清晰的帖子!
如想解决问题,请认真学习“这个帖子”和“这个帖子”并努力遵守,如果可能,请告诉更多的人!
Floor 3 Posted 2006-03-24 13:31 ·  中国 北京 顺义区 联通
银牌会员
★★★
DOS联盟捡破烂的
Credits 1,144
Posts 425
Joined 2005-10-20 00:00
20-year member
UID 43784
From 北京
Status Offline
Brother Shitou seems to be missing a parameter??? START /WAIT program. I don't know if /WAIT is needed in 2003, but it's still needed in the 2000 system. LZ can test it
Floor 4 Posted 2006-03-24 14:14 ·  中国 广东 深圳 宝安区 电信
初级用户
Credits 60
Posts 14
Joined 2006-03-23 09:28
20-year member
UID 52635
Status Offline
Originally posted by bagpipe at 2006-3-24 13:31:
Brother Shi Tou seems to be missing a parameter??? START /WAIT program, I don't know if /WAIT is needed in 2003, it's still needed in 2000 system. LZ can test it


I tried it under XP + SP2, no need for /WAIT.
THANK YOU TWO
Floor 5 Posted 2006-03-24 17:15 ·  中国 河北 石家庄 联通
铂金会员
★★★★
网络独行侠
Credits 6,962
Posts 2,753
Joined 2003-04-16 00:00
23-year member
UID 1565
Gender Male
From 河北保定
Status Offline
Heheh, if you add /wait, then you really can't close the cmd window.
偶只喜欢回答那些标题和描述都很清晰的帖子!
如想解决问题,请认真学习“这个帖子”和“这个帖子”并努力遵守,如果可能,请告诉更多的人!
Floor 6 Posted 2006-03-25 09:19 ·  中国 北京 顺义区 联通
银牌会员
★★★
DOS联盟捡破烂的
Credits 1,144
Posts 425
Joined 2005-10-20 00:00
20-year member
UID 43784
From 北京
Status Offline
Originally posted by Climbing at 2006-3-24 17:15:
Hey, if you add /wait, then the cmd window really can't be closed.



I think I didn't misinterpret the LZ's meaning. The situation I mentioned is under the WIN 2000 system. The LZ's meaning is: "In the BAT statement, we only have such a sentence:

NOTEPAD AA.TXT

After running, the BAT window won't disappear until you close the notepad, and then the BAT window will close." I don't know whether the LZ runs the BAT and then closes the CMD or keeps the CMD window after running and then closes the CMD after ending the program. I don't understand.............................What does the LZ mean!!! Alas
Floor 7 Posted 2006-04-17 17:48 ·  中国 山东 淄博 张店区 电信
新手上路
Credits 5
Posts 3
Joined 2006-04-16 14:57
20-year member
UID 53930
Gender Male
Status Offline
I also encountered this situation. Adding a START solved it. Thanks.
Forum Jump: