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 11:23
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » How to extract a string segment in BAT View 5,128 Replies 16
Original Poster Posted 2004-01-23 00:00 ·  中国 河北 唐山 联通
版主
★★★
操作系统爱好者
Credits 1,113
Posts 392
Joined 2002-11-11 00:00
23-year member
UID 228
Gender Male
Status Offline
Question: Given that the WIN98 installation file is on drive D but I don't know the directory, I want to get its SETUP.EXE file (requiring precise positioning, and not SETUP.EXE of non-WIN98 software), and finally get its complete path, such as: D:\PWIN98\WIN98\SETUP.EXE, and run it. How to achieve it????

Analysis: First, search for files with the unique characteristics of WIN98 in the same directory where the WIN98 installation file is located, such as Win98_30.cab (the method is DIR D:Win98_30.cab /S /B>1.TXT) The content of 1.TXT should be:
D:\PWIN98\WIN98\Win98_30.cab, replace Win98_30.cab with SETUP.EXE

Difficulty: The last step is how to "replace Win98_30.cab with SETUP.EXE"???
I thought of the function of extracting a string segment in QB. As long as I extract all the characters to the left of Win98_30.cab and then combine it with SETUP.EXE, it will be successful. The problem is that I don't want to use QB but use batch processing. How to achieve it???


I am the webmaster of DOS Home. The above program will be used in the newly released "Super Emergency Disk"
Please help everyone. Thank you all
DOS之家 http://doshome.com 站长 葛明阳
Floor 2 Posted 2004-01-23 00:00 ·  加拿大 安大略省 多伦多
系统支持
★★★★★★
“新DOS时代”站长
Credits 27,736
Posts 10,521
Joined 2002-10-09 12:00
23-year member
UID 9
Status Offline
This is not too difficult. In the batch file for finding WIN that I made last time, there is a part specifically for realizing this function.
Wengier - 新DOS时代

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

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

Floor 3 Posted 2004-01-23 00:00 ·  中国 河北 唐山 联通
版主
★★★
操作系统爱好者
Credits 1,113
Posts 392
Joined 2002-11-11 00:00
23-year member
UID 228
Gender Male
Status Offline
Which one is it? Download address? Specific file name??
DOS之家 http://doshome.com 站长 葛明阳
Floor 4 Posted 2004-01-23 00:00 ·  中国 广西 柳州 电信
高级用户
★★★
Credits 915
Posts 309
Joined 2002-12-22 00:00
23-year member
UID 567
Gender Male
Status Offline
The word "super" is now overused everywhere.
Floor 5 Posted 2004-01-23 00:00 ·  加拿大 安大略省 多伦多
系统支持
★★★★★★
“新DOS时代”站长
Credits 27,736
Posts 10,521
Joined 2002-10-09 12:00
23-year member
UID 9
Status Offline
Heheh. By the way, GMY, can you explain the meaning of this "super" thing, thanks!
Wengier - 新DOS时代

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

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

Floor 6 Posted 2004-01-25 00:00 ·  中国 河北 唐山 联通
版主
★★★
操作系统爱好者
Credits 1,113
Posts 392
Joined 2002-11-11 00:00
23-year member
UID 228
Gender Male
Status Offline
"Problems" are to be solved by yourself, "super" is not the key, "emergency rescue" is the key. To be frank, the general-purpose disk of this site is too flashy, not reflecting the role of DOS in emergency rescue. It seems to have many functions, but it still can't be useful when it matters. In the next two days, I will release the 2004 new version of the super emergency rescue disk. You will understand when it comes out.
DOS之家 http://doshome.com 站长 葛明阳
Floor 7 Posted 2004-01-25 00:00 ·  中国 广西 柳州 电信
高级用户
★★★
Credits 915
Posts 309
Joined 2002-12-22 00:00
23-year member
UID 567
Gender Male
Status Offline
The role of DOS is to rescue?
Floor 8 Posted 2004-01-25 00:00 ·  中国 广西 柳州 电信
高级用户
★★★
Credits 915
Posts 309
Joined 2002-12-22 00:00
23-year member
UID 567
Gender Male
Status Offline
Others, Wengier is abroad, and his universal disk is meant to be globally universal, got it?
Floor 9 Posted 2004-01-25 00:00 ·  中国 河北 唐山 联通
版主
★★★
操作系统爱好者
Credits 1,113
Posts 392
Joined 2002-11-11 00:00
23-year member
UID 228
Gender Male
Status Offline
Thanks to LK for the reminder. Now I've figured it out. 1.44 can only do a superficial job. In the future, I'll focus on making CD versions. No need to worry about space. Full functionality!!! Today's task is to make the last floppy disk version "Super Emergency Disk Chinese Simplified and Traditional Bilingual Version"

DOS之家 http://doshome.com 站长 葛明阳
Floor 10 Posted 2004-01-25 00:00 ·  中国 北京 联通
高级用户
★★★
Credits 915
Posts 309
Joined 2002-12-22 00:00
23-year member
UID 567
Gender Male
Status Offline
Oh, you're quite modest, and I'm a bit embarrassed!

By the way, does your forum install the 3721 plug-in that pops up? (I've already blocked 3721, so that's why I'm asking)
Floor 11 Posted 2004-01-25 00:00 ·  加拿大 安大略省 多伦多
系统支持
★★★★★★
“新DOS时代”站长
Credits 27,736
Posts 10,521
Joined 2002-10-09 12:00
23-year member
UID 9
Status Offline
First aid is indeed an important ability of DOS. However, DOS has a wide range of functions, and that "rescue disk" doesn't fully reflect this. It seems that DOS only has the function of "first aid" (first aid for what? Isn't it for rescuing Windows?). Since your website is called "DOS Home" instead of "Windows First Aid Home", it's better to comprehensively reflect the capabilities of DOS to live up to its name, rather than limiting the functions to just one aspect. Of course, the above are just some personal suggestions.
Wengier - 新DOS时代

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

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

Floor 12 Posted 2004-01-26 00:00 ·  中国 山西 太原 联通
元老会员
★★★★
Batchinger
Credits 4,432
Posts 1,512
Joined 2002-10-18 00:00
23-year member
UID 19
Gender Male
Status Offline
Re gmy:

Your task is actually not extraction but replacement. For such problems, early DOS researchers had a common method, which is edlin. As a streaming text editor under DOS, it supports pipe operations and is best at text processing. I just don't know why MS discarded it. For your CASE, DEBUG can be considered. My plan is not mature yet, and I will reply in a few days.
※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得!
Floor 13 Posted 2004-01-26 00:00 ·  中国 河北 沧州 黄骅市 联通
版主
★★★
操作系统爱好者
Credits 1,113
Posts 392
Joined 2002-11-11 00:00
23-year member
UID 228
Gender Male
Status Offline
Thanks for the reply, the replacement problem has been solved. I used HEXC, downloaded from Qibufu, which is only 5K, and supports ASCII and hexadecimal.
The usage format is hexc file.txt file.txt "123" "456" /u, which means replacing 123 with 456 in file.txt. Isn't it very simple?
DOS之家 http://doshome.com 站长 葛明阳
Floor 14 Posted 2004-01-26 00:00 ·  中国 河北 沧州 黄骅市 联通
版主
★★★
操作系统爱好者
Credits 1,113
Posts 392
Joined 2002-11-11 00:00
23-year member
UID 228
Gender Male
Status Offline
I don't know either, because I've installed 3721, and I think it should pop up.
DOS之家 http://doshome.com 站长 葛明阳
Floor 15 Posted 2004-01-27 00:00 ·  中国 山西 太原 联通
元老会员
★★★★
Batchinger
Credits 4,432
Posts 1,512
Joined 2002-10-18 00:00
23-year member
UID 19
Gender Male
Status Offline
Re gmy:

I've always been thinking that you're running batch processing on the boot disk, so I first ruled out solutions that require external programs. hexc should be that string replacement tool attached to undisk, with simple parameter usage and small size. But I think it's not worth going to so much trouble just to start a setup.bat. I've already thought of two solutions with debug, and it seems you're not interested in that, so I'll give you another idea, no need to replace strings.

dir d:setup.exe /s/b | find "WIN98" > setup98.bat
call setup98.bat

Isn't that easy?


※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得!
Forum Jump: