![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-09-23 13:01 |
47,812 topics / 349,917 posts / today 0 new / 48,273 members |
| DOS批处理 & 脚本技术(批处理室) » How to extract a string segment in BAT |
| Printable Version 5,530 / 16 |
| Floor1 gmy | Posted 2004-01-23 00:00 |
| 版主 Posts 392 Credits 1,113 | |
|
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 |
|
| Floor2 Wengier | Posted 2004-01-23 00:00 |
| 系统支持 Posts 10,521 Credits 27,736 | |
|
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.
|
|
| Floor3 gmy | Posted 2004-01-23 00:00 |
| 版主 Posts 392 Credits 1,113 | |
|
Which one is it? Download address? Specific file name??
|
|
| Floor4 LK | Posted 2004-01-23 00:00 |
| 高级用户 Posts 309 Credits 915 | |
|
The word "super" is now overused everywhere.
|
|
| Floor5 Wengier | Posted 2004-01-23 00:00 |
| 系统支持 Posts 10,521 Credits 27,736 | |
|
Heheh. By the way, GMY, can you explain the meaning of this "super" thing, thanks!
|
|
| Floor6 gmy | Posted 2004-01-25 00:00 |
| 版主 Posts 392 Credits 1,113 | |
|
"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.
|
|
| Floor7 LK | Posted 2004-01-25 00:00 |
| 高级用户 Posts 309 Credits 915 | |
|
The role of DOS is to rescue?
|
|
| Floor8 LK | Posted 2004-01-25 00:00 |
| 高级用户 Posts 309 Credits 915 | |
|
Others, Wengier is abroad, and his universal disk is meant to be globally universal, got it?
|
|
| Floor9 gmy | Posted 2004-01-25 00:00 |
| 版主 Posts 392 Credits 1,113 | |
|
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"
|
|
| Floor10 LK | Posted 2004-01-25 00:00 |
| 高级用户 Posts 309 Credits 915 | |
|
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) |
|
| Floor11 Wengier | Posted 2004-01-25 00:00 |
| 系统支持 Posts 10,521 Credits 27,736 | |
|
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.
|
|
| Floor12 willsort | Posted 2004-01-26 00:00 |
| 元老会员 Posts 1,512 Credits 4,432 | |
|
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. |
|
| Floor13 gmy | Posted 2004-01-26 00:00 |
| 版主 Posts 392 Credits 1,113 | |
|
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? |
|
| Floor14 gmy | Posted 2004-01-26 00:00 |
| 版主 Posts 392 Credits 1,113 | |
|
I don't know either, because I've installed 3721, and I think it should pop up.
|
|
| Floor15 willsort | Posted 2004-01-27 00:00 |
| 元老会员 Posts 1,512 Credits 4,432 | |
|
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? |
|
| 1 2 Next |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |