|
gmy
版主
        操作系统爱好者
积分 1113
发帖 392
注册 2002-11-11
状态 离线
|
『楼 主』:
怎样在BAT中实现提取一段字符串
使用 LLM 解释/回答一下
问题:已知WIN98安装文件在D盘,但不知在哪个目录里,我想得到其SETUP.EXE文件,(要求精确定位,非WIN98软件的SETUP.EXE不要),最后得到其完整路径,如: D:\PWIN98\WIN98\SETUP.EXE,运行之.怎么实现????
分析:首先搜索与WIN98安装文件所在目录同一目录,且有WIN98唯一特性的文件,如Win98_30.cab (方法是 DIR D:Win98_30.cab /S /B>1.TXT ) 1.TXT的内容应该是:
D:\PWIN98\WIN98\Win98_30.cab,替换Win98_30.cab为SETUP.EXE
难点:就是最后一步 如何"替换Win98_30.cab为SETUP.EXE" ???
我想到了QB的提取一段字符串的函数,只要把Win98_30.cab左边的全部字符提取出来,再与SETUP.EXE合并就成功了,问题是我不想用QB而用批处理怎么实现???
我是 DOS之家站长 以上程序将用于即将发布的 新版的 "超级急救盘"
请大家帮助.谢谢各位
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 站长 葛明阳 |
|
2004-1-23 00:00 |
|
|
Wengier
系统支持
             “新DOS时代”站长
积分 27736
发帖 10521
注册 2002-10-9
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
这个不算太难,上次我编的那个查找WIN的批处理文件中就有一部分是专门实现该功能的。
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和雨露,谢谢!)
 |
|
2004-1-23 00:00 |
|
|
gmy
版主
        操作系统爱好者
积分 1113
发帖 392
注册 2002-11-11
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
是哪个啊?下载地址?具体文件名??
Which one is it? Download address? Specific file name??
|

DOS之家 http://doshome.com 站长 葛明阳 |
|
2004-1-23 00:00 |
|
|
LK
高级用户
   
积分 915
发帖 309
注册 2002-12-22
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
"超级" 2字现在被到处滥用。
The word "super" is now overused everywhere.
|
|
2004-1-23 00:00 |
|
|
Wengier
系统支持
             “新DOS时代”站长
积分 27736
发帖 10521
注册 2002-10-9
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
呵呵。。对了,GMY,您能不能解释一下这个“超级”的意义所在,谢谢!
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和雨露,谢谢!)
 |
|
2004-1-23 00:00 |
|
|
gmy
版主
        操作系统爱好者
积分 1113
发帖 392
注册 2002-11-11
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
"问题"自己解决,"超级"不是关键,"急救"是关键,说句不客气的话,本站的通用盘太花绍,没体现出DOS在急救中的作用,功能看似很多,关键时候还是派不上用场. 这两天我将发布2004新版的超级急救盘,等出来以后就明白了.
"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 站长 葛明阳 |
|
2004-1-25 00:00 |
|
|
LK
高级用户
   
积分 915
发帖 309
注册 2002-12-22
状态 离线
|
|
2004-1-25 00:00 |
|
|
LK
高级用户
   
积分 915
发帖 309
注册 2002-12-22
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
人家Wengier是在国外,他的通用盘是要做到全球通用,明白?
Others, Wengier is abroad, and his universal disk is meant to be globally universal, got it?
|
|
2004-1-25 00:00 |
|
|
gmy
版主
        操作系统爱好者
积分 1113
发帖 392
注册 2002-11-11
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
谢谢LK提醒,我现在想通了,1.44只能做到轻轻点水,今后专心做光盘版的,不怕没有空间,功能全全全!!!今天的任务是做 最后一软盘版本 "超级急救盘 中文简繁双语版"
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 站长 葛明阳 |
|
2004-1-25 00:00 |
|
|
LK
高级用户
   
积分 915
发帖 309
注册 2002-12-22
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
哦,挺虚心的,我倒有些不好意思了!
顺便问一下:你的论坛和会弹出3721插件的安装么?(3721我已经屏蔽,故有此一问)
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)
|
|
2004-1-25 00:00 |
|
|
Wengier
系统支持
             “新DOS时代”站长
积分 27736
发帖 10521
注册 2002-10-9
状态 离线
|
『第 11 楼』:
使用 LLM 解释/回答一下
急救是DOS的一个重要能力,没错。但DOS的功能很广很多,而那个“急救盘”在这方面完全体现不出来,好像DOS只有“急救”(急救什么?不是急救Windows么?)的功能似的。您的网站既然是“DOS之家”,而不是“Windows急救之家”,最好能比较全面的体现DOS的能力,以名符其实,而不是仅将功能限于某一方面。当然以上仅是一些个人建议罢了。
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和雨露,谢谢!)
 |
|
2004-1-25 00:00 |
|
|
willsort
元老会员
         Batchinger
积分 4432
发帖 1512
注册 2002-10-18
状态 离线
|
『第 12 楼』:
使用 LLM 解释/回答一下
Re gmy:
你的任务实际上不是提取,而是替换。对此类问题,早期的DOS研究者有一类通用的办法,那就是edlin。它作为DOS下的流式文本编辑器,支持管道操作,对于文本的处理最为拿手。只是不知为何MS将它舍弃了。对于你的这个CASE可以考虑使用DEBUG,我的方案尚不成熟,过两天再回复吧。
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:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得! |
|
2004-1-26 00:00 |
|
|
gmy
版主
        操作系统爱好者
积分 1113
发帖 392
注册 2002-11-11
状态 离线
|
『第 13 楼』:
使用 LLM 解释/回答一下
谢谢答复,已经解决替换问题了,用的是HEXC ,起步下载的,只有5K,支持ASCII和16进制
使用格式 hexc file.txt file.txt "123" "456" /u
意思就是在file.txt中替换123为456,是不是很简单?
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 站长 葛明阳 |
|
2004-1-26 00:00 |
|
|
gmy
版主
        操作系统爱好者
积分 1113
发帖 392
注册 2002-11-11
状态 离线
|
『第 14 楼』:
使用 LLM 解释/回答一下
我也不知道,因为我已经安装了3721,我想应该会弹出吧.
I don't know either, because I've installed 3721, and I think it should pop up.
|

DOS之家 http://doshome.com 站长 葛明阳 |
|
2004-1-26 00:00 |
|
|
willsort
元老会员
         Batchinger
积分 4432
发帖 1512
注册 2002-10-18
状态 离线
|
『第 15 楼』:
使用 LLM 解释/回答一下
Re gmy:
我以前一直考虑你在启动盘上运行批处理,所以首先排除了需要外部程序才能解决的方案。hexc应该是undisk附带的那个字符串替换工具吧,参数使用简单,大小也轻便。只是我觉得,为了启动一个setup.bat如此大费周章未免不值。本来debug的方案都已想了两个,看你似乎志不在此,索性给你提供另一个思路吧,不用替换字符串。
dir d:setup.exe /s/b | find "WIN98" > setup98.bat
call setup98.bat
岂不省事?
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:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得! |
|
2004-1-27 00:00 |
|