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:23
中国DOS联盟论坛 » DOS疑难解答 & 问题讨论 (解答室) » How to obtain the value returned after a command is executed View 3,373 Replies 38
Floor 16 Posted 2008-01-04 14:05 ·  中国 广东 深圳 龙岗区 电信
中级用户
★★
Credits 369
Posts 87
Joined 2003-09-14 00:00
22-year member
UID 9822
Gender Male
Status Offline
I have downloaded the pure DOS version of sed from your Google forum and copied it to the C drive. I also modified test1.bat and test2.bat according to your code, but the following error still occurs:

c:\>type a.txt
19

c:\>test1

General error reading drive F
A: Abort, R: Retry, F: Fail? a
c:\>

I don't know what's wrong. Please ask the experts for advice.
Floor 17 Posted 2008-01-04 14:11 ·  中国 广东 深圳 龙岗区 电信
中级用户
★★
Credits 369
Posts 87
Joined 2003-09-14 00:00
22-year member
UID 9822
Gender Male
Status Offline
Re - test found that when entering sed /? at the command line, the following appears:

General error reading drive F
A: Abort, R: Retry, F: Fail? a

Test environment: DOS 7.1
Floor 18 Posted 2008-01-04 14:18 ·  中国 上海 松江区 电信
铂金会员
★★★★
DOS一根葱
Credits 5,493
Posts 2,315
Joined 2006-05-01 10:41
20-year member
UID 54766
Gender Male
From 上海
Status Offline
Oh, you're too... Is the C drive Fat32? Is the C drive in the Path? Is the C drive indeed drive C under DOS? Under DOS, first find sed, or put sed test1 test2 together
第一高手 第二高手

Floor 19 Posted 2008-01-04 15:00 ·  中国 广东 深圳 龙岗区 电信
中级用户
★★
Credits 369
Posts 87
Joined 2003-09-14 00:00
22-year member
UID 9822
Gender Male
Status Offline
They are together, and it's a DOS virtual machine made with Microsoft Virtual PC. The file format is Fat32, and the installed system is DOS 7.1. All the files are in the same directory. test1.bat, test2.bat, sed.exe, and the previously mentioned find.exe, etc., are all together. Thanks!
Floor 20 Posted 2008-01-04 15:02 ·  中国 广东 深圳 龙岗区 电信
中级用户
★★
Credits 369
Posts 87
Joined 2003-09-14 00:00
22-year member
UID 9822
Gender Male
Status Offline
I'm sorry, they are all placed in the root directory of drive C:, including A.TXT. They were copied from drive E:. The same problem occurs under drive E:.
Floor 21 Posted 2008-01-04 15:35 ·  中国 上海 松江区 电信
铂金会员
★★★★
DOS一根葱
Credits 5,493
Posts 2,315
Joined 2006-05-01 10:41
20-year member
UID 54766
Gender Male
From 上海
Status Offline
You need to change your path variable, otherwise there will be endless troubles.
Or try this:
@echo off
call test2.bat 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

:start1
if "%1"=="" goto end
.\sed -n "/%1/p" A.TXT>nul
if not errorlevel 1 if errorlevel 0 goto xxx
shift
goto start1
goto end

:xxx
shift
echo %1>A.TXT

:end


[ Last edited by fastslz on 2008-1-4 at 03:36 PM ]
第一高手 第二高手

Floor 22 Posted 2008-01-04 16:42 ·  中国 广东 深圳 龙岗区 电信
中级用户
★★
Credits 369
Posts 87
Joined 2003-09-14 00:00
22-year member
UID 9822
Gender Male
Status Offline
c:\>type a.txt
2

General error reading drive F
A: Abort, R: Retry, F: Fail? f
Load error: no DPMI - Get csdpm*b.zip

When the "General error reading drive F" prompt appears, entering "f" results in "Load error: no DPMI - Get csdpmi*b.zip"

Ask: What is "DPMI"? What does the above mean? How to solve it?
Floor 23 Posted 2008-01-04 17:32 ·  中国 上海 松江区 电信
铂金会员
★★★★
DOS一根葱
Credits 5,493
Posts 2,315
Joined 2006-05-01 10:41
20-year member
UID 54766
Gender Male
From 上海
Status Offline
Oh, I also overlooked that DPMI is DOS Protected Mode Interface, which provides protection mode support under DOS
http://www.cn-dos.net/forum/viewthread.php?tid=17093&fpage=1&highlight=DPMI
第一高手 第二高手

Floor 24 Posted 2008-01-04 17:49 ·  中国 上海 松江区 电信
铂金会员
★★★★
DOS一根葱
Credits 5,493
Posts 2,315
Joined 2006-05-01 10:41
20-year member
UID 54766
Gender Male
From 上海
Status Offline
Tested this one and it's not very stable. Download the one recommended by the webmaster:
http://www.cn-dos.net/forum/viewthread.php?tid=18577&fpage=1
第一高手 第二高手

Floor 25 Posted 2008-01-04 18:20 ·  中国 广东 深圳 龙岗区 电信
中级用户
★★
Credits 369
Posts 87
Joined 2003-09-14 00:00
22-year member
UID 9822
Gender Male
Status Offline
Thanks for the instruction. Run again:

C:\>DPMI.EXE
C:\>TYPE A.TXT
2

C:\>TEST1
C:\>TYPE A.TXT
2

After running DPMI.EXE, there are no errors, but the content in A.TXT is not added and remains the original value. Also, does DPMI need to be run once before each time sed.exe is run?

Thanks!
Floor 26 Posted 2008-01-04 19:16 ·  中国 上海 松江区 电信
铂金会员
★★★★
DOS一根葱
Credits 5,493
Posts 2,315
Joined 2006-05-01 10:41
20-year member
UID 54766
Gender Male
From 上海
Status Offline
I also tried, it's still unstable.
You can download the latest version of DPMI here http://japheth.de/Download/HXRT.ZIP
sed.exe can also consider using the latest version. vkill has 3 versions of sed http://www.vkill.net
第一高手 第二高手

Floor 27 Posted 2008-01-04 22:57 ·  中国 广东 深圳 龙岗区 电信
中级用户
★★
Credits 369
Posts 87
Joined 2003-09-14 00:00
22-year member
UID 9822
Gender Male
Status Offline
The expert upstairs, the problem still hasn't been solved! Help me, thank you!

The sed.exe in Http://www.vkill.net was not found
Floor 28 Posted 2008-01-05 14:16 ·  中国 上海 松江区 电信
铂金会员
★★★★
DOS一根葱
Credits 5,493
Posts 2,315
Joined 2006-05-01 10:41
20-year member
UID 54766
Gender Male
From 上海
Status Offline
第一高手 第二高手

Floor 29 Posted 2008-01-05 16:55 ·  中国 广东 深圳 龙岗区 电信
中级用户
★★
Credits 369
Posts 87
Joined 2003-09-14 00:00
22-year member
UID 9822
Gender Male
Status Offline
The problem is not solved, and I won't add it! :(:(:(

Asking boss fastslz, is there a way to solve it?

Thank you!

[ Last edited by kavenlee72 on 2008-1-5 at 06:58 PM ]
Floor 30 Posted 2008-01-05 20:21 ·  中国 江苏 无锡 电信
初级用户
Credits 52
Posts 21
Joined 2008-01-01 09:30
18-year member
UID 107370
Gender Male
Status Offline
Try using fc

test1.bat
--------------------------------------------------------------------------------------------
@echo off
call test2.bat 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
type A.TXT
--------------------------------------------------------------------------------------------
test2.bat
--------------------------------------------------------------------------------------------
:start1
echo %1 > A2.TXT
fc A.TXT A2.TXT > nul
shift
if "%1"=="" goto end
if errorlevel 1 goto start1

echo %1 > A.TXT

:end
Forum Jump: