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-07-02 17:56
中国DOS联盟论坛 » DOS疑难解答 & 问题讨论 (解答室) » [Help][Discussion] Is there any expert who can achieve this function under pure DOS? View 3,126 Replies 33
Original Poster Posted 2008-07-27 02:31 ·  中国 河南 新乡 电信
初级用户
Credits 34
Posts 16
Joined 2008-07-24 17:55
17-year member
UID 122015
Gender Male
Status Offline
Is there any expert who can achieve this function under pure DOS?

SMARTDRV.EXE
if exist a:\jieguo.txt del a:\jieguo.txt
md5 -c n:\tools\cfcsys.txt >a:\jieguo.txt
for /f "tokens=2" %%W in (d:\fix\cfcsys.txt) do if /i "%%W" NEQ "OK" goto end
pause
exit

:end
command.com /c n:\gamemenu\system\fix.bat >nul
pause

The file n:\tools\cfcsys.txt actually exists.
No matter what method or software is used, who can fulfill this requirement? I'm seeking help from experts!!!!!

Supplement: The content of cfcsys.txt (just an example)
\89fe32de8587b0dfd76efce00396eb56 *c:\\windows\\NOTEPAD.EXE
\82b8373ed12a602820108f6154bf0c4c *c:\\windows\\explorer.exe
\b313c22a27d1d8677cdec778346d817e *c:\\windows\\regedit.exe
\65a70ec4649499399b50ac75d911a501 *c:\\windows\\system32\\Rundll32.exe
\9cabf264ce1177cafbbba4b910a44c79 *c:\\windows\\system32\\Services.exe
\06955b9a1ce9f54be0193030ef0a6e0e *c:\\windows\\system32\\Winlogon.exe
\722a247acb86960a708528120759266d *c:\\windows\\system32\\cmd.exe
\3502114e4cb83e491a80fc361c1dc7b7 *c:\\windows\\system32\\csrss.exe

The content of jieguo.txt
c:\windows\NOTEPAD.EXE: OK
c:\windows\explorer.exe: OK
c:\windows\regedit.exe: OK
c:\windows\system32\Rundll32.exe: OK
c:\windows\system32\Services.exe: OK
c:\windows\system32\Winlogon.exe: OK
c:\windows\system32\cmd.exe: OK
c:\windows\system32\csrss.exe: OK

[ Last edited by peiliqin on 2008-7-29 at 12:12 AM ]
Floor 2 Posted 2008-07-27 21:24 ·  中国 河南 新乡 电信
初级用户
Credits 34
Posts 16
Joined 2008-07-24 17:55
17-year member
UID 122015
Gender Male
Status Offline
Use other methods, be flexible, or are there other DOS software that can do it?
Floor 3 Posted 2008-07-28 00:33 ·  中国 河南 新乡 电信
初级用户
Credits 34
Posts 16
Joined 2008-07-24 17:55
17-year member
UID 122015
Gender Male
Status Offline
Use other methods, be flexible, or are there other DOS software that can do it? Why is there no one answering?
Floor 4 Posted 2008-07-28 00:38 ·  中国 河南 新乡 电信
初级用户
Credits 34
Posts 16
Joined 2008-07-24 17:55
17-year member
UID 122015
Gender Male
Status Offline
I heard that there is an awk under DOS that can do it, but I can't understand it and am completely confused. Please help out, O great awk experts.
Floor 5 Posted 2008-07-28 00:41 ·  中国 上海 杨浦区 电信
金牌会员
★★★★
Credits 4,639
Posts 2,239
Joined 2005-01-30 00:00
21-year member
UID 35785
Gender Male
Status Offline
I don't know the specific content of the file d:\fix\cfcsys.txt. According to your original meaning, as long as the second word in any line is not "OK", then goto end, that is, each line should have the word "OK". For simplicity, use find /v combined with errorleverl to judge. And why use command/c?
Floor 6 Posted 2008-07-28 19:53 ·  中国 江苏 苏州 电信
高级用户
★★
五星老土
Credits 558
Posts 172
Joined 2003-02-09 00:00
23-year member
UID 881
Gender Male
From 江苏
Status Offline
Looking at his program, it can be guessed that the content of CFCSYS.txt is the result of MD5 check. As long as one file fails, it will run FIX.BAT. Presumably, FIX.BAT is for repairing files that failed the check and so on.

How to do it, I don't know, wait for others.

DOS has become colorful because of FOR. There are only a few commands in pure DOS, and there's no way to take shortcuts, unless using third-party programs.
我怎么找不到一个比我注册日期早的人? 难道我是传说中的超级管理员? 其实我只是个潜水冠军而已.
Floor 7 Posted 2008-07-28 21:17 ·  中国 上海 杨浦区 电信
金牌会员
★★★★
Credits 4,639
Posts 2,239
Joined 2005-01-30 00:00
21-year member
UID 35785
Gender Male
Status Offline
It seems quite simple, with nothing complicated. The problem is that his a:\jieguo.txt doesn't seem to have anything to do with d:\fix\cfcsys.txt. Why doesn't he verify OK in a:\jieguo.txt but look for OK in d:\fix\cfcsys.txt?
Floor 8 Posted 2008-07-29 00:15 ·  中国 河南 新乡 电信
初级用户
Credits 34
Posts 16
Joined 2008-07-24 17:55
17-year member
UID 122015
Gender Male
Status Offline
Originally posted by quya at 2008-7-28 07:53 PM:
Looking at his program, it can be guessed that the content of CFCSYS.txt is the result of MD5 check. As long as one file fails, it will run FIX.BAT, and FIX.BAT is presumably to repair the files that failed the check...


cfcsys.txt is a standard file, and jieguo.txt is a temporary file generated according to CFCSYS.txt.
Floor 9 Posted 2008-07-29 07:45 ·  中国 安徽 马鞍山 电信
金牌会员
★★★★
Credits 3,946
Posts 1,884
Joined 2006-01-20 13:00
20-year member
UID 49283
Gender Male
Status Offline
You can use the method of intercepting the last two characters of each line. If it is not equal to OK, then repair it. strings can be used.
Windows 一键还原
http://www.yjhy.com
Floor 10 Posted 2008-07-29 07:59 ·  中国 河南 新乡 电信
初级用户
Credits 34
Posts 16
Joined 2008-07-24 17:55
17-year member
UID 122015
Gender Male
Status Offline
Originally posted by DOSforever at 2008-7-28 12:41 AM:
I don't know what the specific content of the file d:\fix\cfcsys.txt is. According to your original meaning, as long as the second word in a line is not "OK", then goto end, that is, each line should have &...


Tried it, but when the content of the file changes, it's always impossible to determine the value of errorlevel. Can't perform the jump.
Floor 11 Posted 2008-07-29 08:01 ·  中国 河南 新乡 电信
初级用户
Credits 34
Posts 16
Joined 2008-07-24 17:55
17-year member
UID 122015
Gender Male
Status Offline
Originally posted by lianjiang2004 at 2008-7-29 07:45 AM:
You can use the method of intercepting the last two characters of each line. If it is not equal to OK, then repair it. The strings command can do it.



I also looked at this parameter, but I don't know how to get the value of strings. Can you give an exact example?
Floor 12 Posted 2008-07-29 09:56 ·  中国 上海 杨浦区 电信
金牌会员
★★★★
Credits 4,639
Posts 2,239
Joined 2005-01-30 00:00
21-year member
UID 35785
Gender Male
Status Offline
Originally posted by peiliqin at 2008-7-29 07:59:

Tried it, but when the file content changes, I can't always determine the errorlevel value. Can't jump.

My understanding is that as long as there is one that is not OK, just goto. If find/v finds one that is not OK, it returns exit code 0. If not found, it returns 1, which means all are OK. Why "can't always determine the errorlevel value"?
Floor 13 Posted 2008-07-29 20:18 ·  中国 山西 电信
银牌会员
★★★
天的白色影子
Credits 2,343
Posts 636
Joined 2004-03-06 00:00
22-year member
UID 19350
Gender Male
Status Offline
Using command /c is to suppress the output of fix.bat
But still don't understand the relationship between d:\fix\cfcsys.txt and n:\tools\cfcsys.txt
Give a most simplified prototype code according to the idea of building 12
Can refer to


find /v /i "OK" <d:\fix\cfcsys.txt>nul
if errorlevel 1 exit
command.com /c n:\gamemenu\system\fix.bat >nul
Floor 14 Posted 2008-07-29 21:34 ·  中国 河南 新乡 电信
初级用户
Credits 34
Posts 16
Joined 2008-07-24 17:55
17-year member
UID 122015
Gender Male
Status Offline
My understanding is that as long as you have one that is not OK, you goto. find/v. If you find one that is not OK, return exit code 0. If none are found, return 1, indicating that all are OK. Why does "always fail to determine the errorlevel value"?

I tested, the effects of 1 and 0 are the same. When it's 2, it's completely a different effect. I can check the return code of the previous command in cmd under Windows, but under pure DOS, I don't know how to check it.
Floor 15 Posted 2008-07-29 21:39 ·  中国 上海 电信
金牌会员
★★★★
Credits 4,639
Posts 2,239
Joined 2005-01-30 00:00
21-year member
UID 35785
Gender Male
Status Offline
Please provide the specific Chinese content that needs to be translated. Without the Chinese text to translate, I can't perform the translation.
Forum Jump: