|
xiaofking
初级用户
 
积分 72
发帖 31
注册 2007-6-9
状态 离线
|
『楼 主』:
[已解决]半年多都没解决的纯DOS批处理问题
使用 LLM 解释/回答一下
已经求助过很多批处理的高手,但纯DOS下真的太难实现,findstr用不了,大家帮帮忙吧,是否借助第三方工具能实现,简单介绍如下:
纯DOS下,运行某DOS程序Gdisk,屏幕输出文本内容如下
AAA BBB CCC //第一行
xxx yyy zzz //第二行
以上字母皆为替代,只是大概输出如此(输出的这些字符串全部显示在纯DOS画面中,没有生成文本文件)
现在要求判断Gdisk的以上输出,如果第二行中有出现字符串“A01”或"A02",就执行语句go1,如果没有就重启
大概就是这样了,大家提些思路好吗,是否要用到类似input,askenv,aset,xset,strings,wbat,be这些第三方工具?能否给出批处理的大概写法
Last edited by xiaofking on 2008-1-14 at 01:20 PM ]
I've asked many batch processing experts, but it's really too difficult to achieve in pure DOS. findstr can't be used. Everyone, please help. Is it possible to achieve it with the help of third-party tools? The simple introduction is as follows:
In pure DOS, running a certain DOS program Gdisk, the screen outputs text content as follows
AAA BBB CCC // The first line
xxx yyy zzz // The second line
The above letters are all substitutes, just roughly output like this (all the output strings are displayed in the pure DOS screen, no text file is generated)
Now it is required to judge the above output of Gdisk. If "A01" or "A02" appears in the second line, execute the statement go1; if not, restart
Probably like this. Can you put forward some ideas? Do you need to use third-party tools like input, askenv, aset, xset, strings, wbat, be? Can you give the general writing of the batch processing?
Last edited by xiaofking on 2008-1-14 at 01:20 PM ]
|
|
2008-1-11 14:51 |
|
|
不得不爱
超级版主
         我爱DOS
积分 5310
发帖 2044
注册 2005-9-26 来自 四川南充
状态 离线
|
|
2008-1-11 14:53 |
|
|
xiaofking
初级用户
 
积分 72
发帖 31
注册 2007-6-9
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
版主。。。能不能根据我的流程写几句看看
Moderator... Can you write a few sentences according to my process?
|
|
2008-1-11 15:02 |
|
|
xiaofking
初级用户
 
积分 72
发帖 31
注册 2007-6-9
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
或者给我一个nset的使用方法行不行,我在网上只能找到这么一句
Nset.com 从输出中取得变量以设置,FINDCD -a|NSET CDROM=$1
Or can you give me a usage method of nset? I can only find this sentence on the Internet: Nset.com gets variables from the output to set, FINDCD -a|NSET CDROM=$1
|
|
2008-1-11 15:05 |
|
|
qzwqzw
银牌会员
     天的白色影子
积分 2343
发帖 636
注册 2004-3-6
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
只用dos自带的find就可以了
如果只是忽略大小写查找A01,那么
gdisk| find "A01" /i>nul
if errorlevel 1 goto end
:go1
::其它语句
:end
如果指定在第二行忽略大小写查找A01,那么
gdisk | find "" /v/n | find "[2]" | find "A01" /i>nul
if errorlevel 1 goto end
:go1
::其它语句
:end
You can only be achieved with the built-in find of DOS. If you just want to perform a case-insensitive search for A01, then
gdisk| find "A01" /i>nul
if errorlevel 1 goto end
:go1
::Other statements
:end
If you specify to perform a case-insensitive search for A01 in the second line, then
gdisk | find "" /v/n | find "" | find "A01" /i>nul
if errorlevel 1 goto end
:go1
::Other statements
:end
|
|
2008-1-11 19:30 |
|
|
xiaofking
初级用户
 
积分 72
发帖 31
注册 2007-6-9
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
find 在纯DOS无法使用....
find 在纯DOS无法使用....
find in pure DOS cannot be used....
|
|
2008-1-11 21:38 |
|
|
xiaofking
初级用户
 
积分 72
发帖 31
注册 2007-6-9
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
纯DOS也无法指定在第几行查找的
In pure DOS, you can't specify which line to search on.
|
|
2008-1-11 21:39 |
|
|
xiaofking
初级用户
 
积分 72
发帖 31
注册 2007-6-9
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
find可以用...但你上面的方法是不行的
find can be used... but the method you mentioned above doesn't work
|
|
2008-1-11 21:51 |
|
|
zh159
金牌会员
     
积分 3687
发帖 1467
注册 2005-8-8
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
纯DOS下find是外部命令,所以你得找一个DOS下的find
In pure DOS, `find` is an external command, so you need to find a `find` for DOS.
|

 |
|
2008-1-11 21:59 |
|
|
xiaofking
初级用户
 
积分 72
发帖 31
注册 2007-6-9
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
试过了,无论是运行nset还是find,在纯DOS下都会出现
“未准备写驱动器A”A:放弃,R:重试,F:失败?
证明nset和find都是需要写入缓存的命令。。。没作用啊。。。
I've tried it. Whether running nset or find, in pure DOS, it will all appear "Drive A is not ready to write" A: Abort, R: Retry, F: Fail? It proves that both nset and find are commands that need to write to the cache... It doesn't work...
|
|
2008-1-12 00:35 |
|
|
fastslz
铂金会员
       DOS一根葱
积分 5493
发帖 2315
注册 2006-5-1 来自 上海
状态 离线
|
|
2008-1-12 00:40 |
|
|
xiaofking
初级用户
 
积分 72
发帖 31
注册 2007-6-9
状态 离线
|
『第 12 楼』:
使用 LLM 解释/回答一下
仔细看过了,问题是我没办法生成一个txt文件,而且 | 这个符号在纯DOS也无法使用,Gdisk -a 后直接输出在画面上的
I've read it carefully. The problem is that I can't generate a txt file, and the symbol "|" can't be used in pure DOS either. After Gdisk -a, it's directly output on the screen.
|
|
2008-1-12 00:55 |
|
|
xiaofking
初级用户
 
积分 72
发帖 31
注册 2007-6-9
状态 离线
|
『第 13 楼』:
使用 LLM 解释/回答一下
找了N多个工具,其实问题就是在于如何不用输出txt文件也可以实现这个功能,如果要输出txt文件的话就简单了
I've looked for many tools. Actually, the problem is how to achieve this function without outputting a txt file. If outputting a txt file is concerned, it's simple.
|
|
2008-1-12 01:44 |
|
|
fastslz
铂金会员
       DOS一根葱
积分 5493
发帖 2315
注册 2006-5-1 来自 上海
状态 离线
|
『第 14 楼』:
使用 LLM 解释/回答一下
“未准备写驱动器A”A:放弃,R:重试,F:失败?
11楼看到了吗
Originally posted by fastslz at 2008-1-4 12:10:
我猜测分析下是什么原因吧
F应该是你的光盘盘符,你启动的DOS下没有find.com外部命令,而Path变量里有%CDROM%或F:\.....,这个时候DOS就尝试读取光盘下目 ...
我猜测分析下是什么原因吧
猜测1: 你的电脑应该有软驱的,你启动的DOS下没有find.com外部命令,而Path变量里有A:\,这个时候DOS就尝试读取A:\目录下寻找find.com,所以出现一般性错误读驱动器A:\。
猜测2: 你的电脑应该有软驱的,你启动的DOS下没有find.com外部命令,你就拷贝了xp下的find.exe在纯DOS用,xp的find是32位子程序在纯dos下用需要32位支持文件CWSDPMI,而Path变量里有A:\,这个时候DOS就尝试读取A:\目录下寻找CWSDPMI.exe,所以出现一般性错误读驱动器A:\。
无法生成一个txt文件,不是因为 | 符号在纯DOS也无法使用,在猜测2里已经说明了,是因为find 命令没执行成功,没执行成功当然不会生成txt文件
"Drive A is not ready" A: Abort, R: Retry, F: Fail?
Did you see it on floor 11
Originally posted by fastslz at 2008-1-4 12:10:
Let me guess and analyze the reason
F should be your CD-ROM drive letter. There is no find.com external command in the DOS you booted into, and the Path variable has %CDROM% or F:\....., then DOS tries to read the directory on the CD-ROM...
Let me guess and analyze the reason
Guess 1: Your computer should have a floppy drive. There is no find.com external command in the DOS you booted into, and the Path variable has A:\, then DOS tries to read the A:\ directory to find find.com, so a general error occurs reading drive A:\.
Guess 2: Your computer should have a floppy drive. There is no find.com external command in the DOS you booted into, you copied the xp find.exe to use in pure DOS. The xp find is a 32-bit subroutine. To use it in pure DOS, 32-bit support file CWSDPMI is needed. And the Path variable has A:\, then DOS tries to read the A:\ directory to find CWSDPMI.exe, so a general error occurs reading drive A:\.
Unable to generate a txt file, not because the | symbol cannot be used in pure DOS. It has been explained in Guess 2 that it is because the find command did not execute successfully. If it did not execute successfully, of course a txt file will not be generated
|

第一高手 第二高手
我的小站
 |
|
2008-1-12 01:45 |
|
|
terse
银牌会员
    
积分 2404
发帖 946
注册 2005-9-8
状态 离线
|
『第 15 楼』:
使用 LLM 解释/回答一下
lmod 应该可以指定行的 你gdisk先输出不就可以了 是不是一定要输出在画面上呢
lmod should be able to specify lines. Can't you just output it with gdisk first? Does it have to be output on the screen?
|

简单!简单!再简单! |
|
2008-1-12 01:57 |
|