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-07 07:19
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Solved] Pure DOS Batch Processing Problem That Hasn't Been Resolved for More Than Half a Year View 2,540 Replies 31
Original Poster Posted 2008-01-11 14:51 ·  中国 广东 广州 天河区 电信
初级用户
Credits 72
Posts 31
Joined 2007-06-09 00:26
19-year member
UID 90742
Gender Male
Status Offline
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 ]
Floor 2 Posted 2008-01-11 14:53 ·  中国 四川 南充 电信
超级版主
★★★★
我爱DOS
Credits 5,310
Posts 2,044
Joined 2005-09-26 12:00
20-year member
UID 42843
Gender Male
From 四川南充
Status Offline
Floor 3 Posted 2008-01-11 15:02 ·  中国 广东 广州 天河区 电信
初级用户
Credits 72
Posts 31
Joined 2007-06-09 00:26
19-year member
UID 90742
Gender Male
Status Offline
Moderator... Can you write a few sentences according to my process?
Floor 4 Posted 2008-01-11 15:05 ·  中国 广东 广州 天河区 电信
初级用户
Credits 72
Posts 31
Joined 2007-06-09 00:26
19-year member
UID 90742
Gender Male
Status Offline
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
Floor 5 Posted 2008-01-11 19:30 ·  中国 山西 运城 联通
银牌会员
★★★
天的白色影子
Credits 2,343
Posts 636
Joined 2004-03-06 00:00
22-year member
UID 19350
Gender Male
Status Offline
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 "[2]" | find "A01" /i>nul
if errorlevel 1 goto end
:go1
::Other statements
:end
Floor 6 Posted 2008-01-11 21:38 ·  中国 广东 广州 广东金万邦科技投资有限公司(新一代数据中心)IDC机房(BGP)
初级用户
Credits 72
Posts 31
Joined 2007-06-09 00:26
19-year member
UID 90742
Gender Male
Status Offline
find 在纯DOS无法使用....
find in pure DOS cannot be used....
Floor 7 Posted 2008-01-11 21:39 ·  中国 广东 广州 广东金万邦科技投资有限公司(新一代数据中心)IDC机房(BGP)
初级用户
Credits 72
Posts 31
Joined 2007-06-09 00:26
19-year member
UID 90742
Gender Male
Status Offline
In pure DOS, you can't specify which line to search on.
Floor 8 Posted 2008-01-11 21:51 ·  中国 广东 广州 广东金万邦科技投资有限公司(新一代数据中心)IDC机房(BGP)
初级用户
Credits 72
Posts 31
Joined 2007-06-09 00:26
19-year member
UID 90742
Gender Male
Status Offline
find can be used... but the method you mentioned above doesn't work
Floor 9 Posted 2008-01-11 21:59 ·  中国 广西 玉林 电信
金牌会员
★★★★
Credits 3,687
Posts 1,467
Joined 2005-08-08 12:00
20-year member
UID 44210
Status Offline
In pure DOS, `find` is an external command, so you need to find a `find` for DOS.
Floor 10 Posted 2008-01-12 00:35 ·  中国 广东 广州 广东金万邦科技投资有限公司(新一代数据中心)IDC机房(BGP)
初级用户
Credits 72
Posts 31
Joined 2007-06-09 00:26
19-year member
UID 90742
Gender Male
Status Offline
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...
Floor 11 Posted 2008-01-12 00:40 ·  中国 上海 松江区 电信
铂金会员
★★★★
DOS一根葱
Credits 5,493
Posts 2,315
Joined 2006-05-01 10:41
20-year member
UID 54766
Gender Male
From 上海
Status Offline
Originally posted by xiaofking at 2008-1-12 00:35:
Tried it. Whether running nset or find, in pure DOS, the following appears:
"Drive A not ready to write. A: Abort, R: Retry, F: Fail?"

This proves that both nset and find are commands that require writing to the cache... It doesn't work...


Here's the answer
http://www.cn-dos.net/forum/viewthread.php?tid=36718&fpage=1&highlight=
第一高手 第二高手

Floor 12 Posted 2008-01-12 00:55 ·  中国 广东 广州 广东金万邦科技投资有限公司(新一代数据中心)IDC机房(BGP)
初级用户
Credits 72
Posts 31
Joined 2007-06-09 00:26
19-year member
UID 90742
Gender Male
Status Offline
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.
Floor 13 Posted 2008-01-12 01:44 ·  中国 广东 广州 广东金万邦科技投资有限公司(新一代数据中心)IDC机房(BGP)
初级用户
Credits 72
Posts 31
Joined 2007-06-09 00:26
19-year member
UID 90742
Gender Male
Status Offline
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.
Floor 14 Posted 2008-01-12 01:45 ·  中国 上海 松江区 电信
铂金会员
★★★★
DOS一根葱
Credits 5,493
Posts 2,315
Joined 2006-05-01 10:41
20-year member
UID 54766
Gender Male
From 上海
Status Offline
"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
第一高手 第二高手

Floor 15 Posted 2008-01-12 01:57 ·  中国 江苏 常州 溧阳市 电信
银牌会员
★★★
Credits 2,404
Posts 946
Joined 2005-09-08 13:44
20-year member
UID 42345
Status Offline
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?
简单!简单!再简单!
Forum Jump: