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-02 03:32
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » How to tell in a batch file whether a certain program has already been loaded? View 1,405 Replies 8
Original Poster Posted 2002-11-30 00:00 ·  中国 广东 广州 电信
元老会员
★★★
Credits 1,468
Posts 407
Joined 2002-10-21 00:00
23-year member
UID 34
Gender Male
From 广州
Status Offline
In a batch file, sometimes you want to determine whether a TSR has already been run, so as to execute the corresponding program. What I want to ask is: is there any way to let a batch file detect this automatically?
欢迎大家观临我的个人主页:

http://dosdiy.bluepc.com.cn/
http://dosdiy.ys168.com/


EMAIL: lydong@china.com.cn lydong@yeah.net
----------------------------------------------
Floor 2 Posted 2002-12-01 00:00 ·  中国 广东 佛山 三水区 电信
元老会员
★★★★
Credits 5,170
Posts 1,637
Joined 2002-10-16 00:00
23-year member
UID 8
Gender Male
From 广东佛山
Status Offline
Unless you set an environment variable when starting it, it is impossible for a batch file itself to detect whether a program has already been loaded.
For example, add a line after UCDOS.BAT: “set ucdos=onload"
And if you write a batch file to exit UCDOS, also add "SET UCDOS=" after it
That way, in the batch file you can use IF UCDOS =="onload" to determine whether UCDOS has been loaded.
我的网志
http://hzmys.blog.163.com/
我的网盘
firststep.qjwm.com
fsmys.ys168.com
ssmys.ys168.com
www.brsbox.com/fsmys
www.brsbox.com/ssmys
www.brsbox.com/ccdos
Floor 3 Posted 2002-12-01 00:00 ·  美国 肯塔基州 费耶特县 列克星敦 Charter_Communications
系统支持
★★★★★★
“新DOS时代”站长
Credits 27,736
Posts 10,521
Joined 2002-10-09 12:00
23-year member
UID 9
Status Offline
You can use some specialized tools, such as TSR Utils, to determine whether a specified program has already been loaded.
Wengier - 新DOS时代

欢迎大家来到我的“新DOS时代”网站,里面有各类DOS软件和资料,地址:
http://wendos.mycool.net/

E-Mail & MSN: wengierwu AT hotmail.com (最近比较忙,有事请联系DOSroot和雨露,谢谢!)

Floor 4 Posted 2002-12-01 00:00 ·  中国 广东 广州 增城区 电信
元老会员
★★★
Credits 1,468
Posts 407
Joined 2002-10-21 00:00
23-year member
UID 34
Gender Male
From 广州
Status Offline
I downloaded TSR Utils, but I don't know how to use it. Wengier, could you introduce it a bit? Thanks!
欢迎大家观临我的个人主页:

http://dosdiy.bluepc.com.cn/
http://dosdiy.ys168.com/


EMAIL: lydong@china.com.cn lydong@yeah.net
----------------------------------------------
Floor 5 Posted 2002-12-01 00:00 ·  美国 肯塔基州 费耶特县 列克星敦 Charter_Communications
系统支持
★★★★★★
“新DOS时代”站长
Credits 27,736
Posts 10,521
Joined 2002-10-09 12:00
23-year member
UID 9
Status Offline
For example: MAPMEM /C COMMAND can determine whether COMMAND is loaded. If you also want to include UMB, add the /U option, that is, MAPMEM /U /C COMMAND. It can not only directly display on the screen whether this program has already been loaded, it will also automatically set the ERRORLEVEL value: if it is loaded, it is 0; if not loaded, it is 2; if there is a syntax error, it is 1.
Wengier - 新DOS时代

欢迎大家来到我的“新DOS时代”网站,里面有各类DOS软件和资料,地址:
http://wendos.mycool.net/

E-Mail & MSN: wengierwu AT hotmail.com (最近比较忙,有事请联系DOSroot和雨露,谢谢!)

Floor 6 Posted 2002-12-01 00:00 ·  中国 广东 广州 增城区 电信
元老会员
★★★
Credits 1,468
Posts 407
Joined 2002-10-21 00:00
23-year member
UID 34
Gender Male
From 广州
Status Offline
Why does it stop moving as soon as I enter it (it seems to hang)? I don't know whether there is a problem with the software.
The prompt is as follows:
c:\tsrcom35>mapmem /c command
MAPMEM 3.5, Copyright 1993 TurboPower Software
_
欢迎大家观临我的个人主页:

http://dosdiy.bluepc.com.cn/
http://dosdiy.ys168.com/


EMAIL: lydong@china.com.cn lydong@yeah.net
----------------------------------------------
Floor 7 Posted 2002-12-02 00:00 ·  美国 肯塔基州 费耶特县 列克星敦 Charter_Communications
系统支持
★★★★★★
“新DOS时代”站长
Credits 27,736
Posts 10,521
Joined 2002-10-09 12:00
23-year member
UID 9
Status Offline
No way! Could it be that your system was unstable at the time?
Wengier - 新DOS时代

欢迎大家来到我的“新DOS时代”网站,里面有各类DOS软件和资料,地址:
http://wendos.mycool.net/

E-Mail & MSN: wengierwu AT hotmail.com (最近比较忙,有事请联系DOSroot和雨露,谢谢!)

Floor 8 Posted 2003-03-18 00:00 ·  中国 广东 江门 电信
中级用户
★★
Credits 355
Posts 73
Joined 2003-02-24 00:00
23-year member
UID 992
Gender Male
Status Offline
Try this! Open attachment
Floor 9 Posted 2006-09-24 09:13 ·  新加坡 腾讯云
初级用户
Credits 73
Posts 30
Joined 2006-09-18 08:35
19-year member
UID 62944
Status Offline
::Check whether there is a specified running program in the process list, such as 'explorer.exe'
::------------BY MOBO[墨伯]
::-------------2006-09-22
wmic process where name='explorer.exe' get caption>out.txt

We should still make more use of WMIC. A stone from another mountain may polish jade; it provides a large number of interfaces for reading software and hardware [about 6000 properties], and also some methods, all of them quite useful.
Forum Jump: