|
quya
高级用户
    五星老土
积分 558
发帖 172
注册 2003-2-9 来自 江苏
状态 离线
|
『楼 主』:
[求助]2个文件比较的问题
使用 LLM 解释/回答一下
假定我有以下2个文件
1.txt
HPQ CD4E1902
Pavilion 06D652A4
Lenovo 5237B729
LEGEND 7B06BD13
IBM D7A77612
TOSHIBA A16F9D62
FUJITSU 10045CFA
FUJITSUS D2D64C41
HEDY 162C7931
Founder 3A0C0121
2.txt
G:\I386\OEMBIOS.CA_
G:\WXPOEM\1\OEMBIOS.CAT
G:\WXPOEM\2\OEMBIOS.CAT
G:\WXPOEM\3\OEMBIOS.CA_
G:\WXPOEM\4\OEMBIOS.CAT
G:\WXPOEM\5\OEMBIOS.CAT
G:\WXPOEM\6\OEMBIOS.CAT
G:\WXPOEM\7\OEMBIOS.CAT
G:\WXPOEM\8\OEMBIOS.CAT
F:\cpl\thif\OEMBIOS.CA_
F:\新建文件夹\Acer\OEMBIOS.CA_
F:\新建文件夹\xxx\OEMBIOS.CA_
F:\新建文件夹\Lenovo\oembios.ca_
F:\新建文件夹\xx\OEMBIOS.CA_
现在我得到一个变量值,比如 HEDY,是在文件 1.txt中的行的第一个值。
我对2.txt中路径中的文件(如果是压缩文件则先EXPAND)进行CRC32 校验, 运行 CRC32.EXE, 假定得到的CRC 输出结果在第一行第2个Token, 然后和文件 1.txt第2行值比较,IF FIND, 则把对应的路径赋值给一个变量。
如何在不用第三方程序的前提下高效简洁易懂地写出代码? 谢谢。
补充一下,CRC值校验只运行一次, 但可能要多次调用校验的结果, 所以生成如下的结果文件比较恰当.
LEGEND 7B06BD13 F:\新建文件夹\xxx\OEMBIOS.CA_
HEDY 162C7931 G:\WXPOEM\5\OEMBIOS.CAT
Last edited by quya on 2008-7-9 at 12:01 PM ]
Suppose I have the following 2 files
1.txt
HPQ CD4E1902
Pavilion 06D652A4
Lenovo 5237B729
LEGEND 7B06BD13
IBM D7A77612
TOSHIBA A16F9D62
FUJITSU 10045CFA
FUJITSUS D2D64C41
HEDY 162C7931
Founder 3A0C0121
2.txt
G:\I386\OEMBIOS.CA_
G:\WXPOEM\1\OEMBIOS.CAT
G:\WXPOEM\2\OEMBIOS.CAT
G:\WXPOEM\3\OEMBIOS.CA_
G:\WXPOEM\4\OEMBIOS.CAT
G:\WXPOEM\5\OEMBIOS.CAT
G:\WXPOEM\6\OEMBIOS.CAT
G:\WXPOEM\7\OEMBIOS.CAT
G:\WXPOEM\8\OEMBIOS.CAT
F:\cpl\thif\OEMBIOS.CA_
F:\新建文件夹\Acer\OEMBIOS.CA_
F:\新建文件夹\xxx\OEMBIOS.CA_
F:\新建文件夹\Lenovo\oembios.ca_
F:\新建文件夹\xx\OEMBIOS.CA_
Now I get a variable value, for example HEDY, which is the first value in the line in file 1.txt.
I perform CRC32 checksum on the files in the paths in 2.txt (if it is a compressed file, first EXPAND), run CRC32.EXE, assume that the CRC output result is the 2nd token in the first line, then compare with the 2nd line value in file 1.txt, IF FIND, then assign the corresponding path to a variable.
How to write code efficiently, concisely and understandably without using third-party programs? Thanks.
To supplement, the CRC value check is only run once, but the result of the check may be called multiple times, so generating the following result file is more appropriate.
LEGEND 7B06BD13 F:\新建文件夹\xxx\OEMBIOS.CA_
HEDY 162C7931 G:\WXPOEM\5\OEMBIOS.CAT
Last edited by quya on 2008-7-9 at 12:01 PM ]
|

我怎么找不到一个比我注册日期早的人? 难道我是传说中的超级管理员? 其实我只是个潜水冠军而已. |
|
2008-7-9 11:28 |
|
|
huahua0919
银牌会员
    
积分 1608
发帖 780
注册 2007-10-7
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
你这个是不是进行md5效验后检查是否为病毒附本的?
Is this something that checks if it's a virus copy after MD5 verification?
|
|
2008-7-9 12:40 |
|
|
bat-zw
金牌会员
      永远的学习者
积分 3105
发帖 1276
注册 2008-3-8
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
没用过crc32,估摸着写的:
@echo off
for /f "delims=" %%i in (2.txt) do crc32 %%i>>crc.txt
for /f "tokens=2" %%a in (1.txt) do (
for /f "tokens=1,3" %%i in ('findstr "%%a" crc.txt') do if "%%i" neq "" echo set %%i=%%j
)
pause>nul
Last edited by zw19750516 on 2008-7-9 at 01:27 PM ]
Didn't use crc32, roughly wrote:
@echo off
for /f "delims=" %%i in (2.txt) do crc32 %%i>>crc.txt
for /f "tokens=2" %%a in (1.txt) do (
for /f "tokens=1,3" %%i in ('findstr "%%a" crc.txt') do if "%%i" neq "" echo set %%i=%%j
)
pause>nul
Last edited by zw19750516 on 2008-7-9 at 01:27 PM ]
|

批处理之家新域名:www.bathome.net |
|
2008-7-9 13:19 |
|
|
quya
高级用户
    五星老土
积分 558
发帖 172
注册 2003-2-9 来自 江苏
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
我这个问题想想还是比较复杂的.
1. 首先要把未解压的释放到临时目录校验, 因为最初目录可能是只读的,这种情况下要保存原先未解压的路径值.
2. 就像我一楼帖子最后补充的, 我要把结果放到一个文件中多次调用. 至于CRC运行命令格式和结果是次要的, 只要知道它一定会输出个结果就是了. 就像3楼一样我们只要知道有那么个CRC.TXT文件,里边有各式各样的值就可以了.
3. 难的是把比较以后的结果, 即把1.txt, 2.txt, crc.txt 通过一个特征值再次输出.
This problem I think is relatively complicated.
1. First, we need to extract the unzipped files to a temporary directory for verification. Because the original directory may be read-only, in this case, we need to save the original unzipped path value.
2. Just like I supplemented at the end of my first-floor post, I need to put the results into a file for multiple calls. As for the CRC running command format and the result, it's secondary. As long as we know it will definitely output a result. Just like in the 3rd floor, we just need to know that there is a CRC.TXT file, and there are various values in it.
3. The difficult part is to output the result after comparison, that is, to output the values of 1.txt, 2.txt, and crc.txt through a feature value again.
|

我怎么找不到一个比我注册日期早的人? 难道我是传说中的超级管理员? 其实我只是个潜水冠军而已. |
|
2008-7-9 13:35 |
|
|
26933062
银牌会员
    
积分 2268
发帖 879
注册 2006-12-19
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
最好能给出部分crc.txt文件的的样本来。。。
It would be best to give some samples of the part of the crc.txt file...
|

致精致简! |
|
2008-7-9 13:41 |
|
|
quya
高级用户
    五星老土
积分 558
发帖 172
注册 2003-2-9 来自 江苏
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
Originally posted by 26933062 at 2008-7-9 01:41 PM:
最好能给出部分crc.txt文件的的样本来。。。
我记不得样本了,但这是个普遍问题.
F:\新建文件夹\xxx\OEMBIOS.CA_ 假定这儿 expand F:\新建文件夹\xxx\OEMBIOS.CA_ %temp%\OEMBIOS.CAT
crc32 %temp%\OEMBIOS.CAT
运行结果 ??? 7B06BD13 ???? (仅举个例子,和实际可能不一样,???表示任何东西)
G:\WXPOEM\5\OEMBIOS.CAT
crc32 G:\WXPOEM\5\OEMBIOS.CAT
运行结果 ??? 162C7931 ????
为了具有普遍性, 假定我先设法得到以下一个 CRC 文件(其实这个文件可以不要,只要最后结果,但不妨一步一步来)
CRC.TXT
G:\I386\OEMBIOS.CA_ ???
G:\WXPOEM\1\OEMBIOS.CAT ??? (以下略)
G:\WXPOEM\2\OEMBIOS.CAT
G:\WXPOEM\3\OEMBIOS.CA_
G:\WXPOEM\4\OEMBIOS.CAT
G:\WXPOEM\5\OEMBIOS.CAT 162C7931
G:\WXPOEM\6\OEMBIOS.CAT
G:\WXPOEM\7\OEMBIOS.CAT
G:\WXPOEM\8\OEMBIOS.CAT
F:\cpl\thif\OEMBIOS.CA_
F:\新建文件夹\Acer\OEMBIOS.CA_
F:\新建文件夹\xxx\OEMBIOS.CA_ 7B06BD13
F:\新建文件夹\Lenovo\oembios.ca_
F:\新建文件夹\xx\OEMBIOS.CA_
最后我想得到的就是类似下面这个结果
LEGEND 7B06BD13 F:\新建文件夹\xxx\OEMBIOS.CA_
HEDY 162C7931 G:\WXPOEM\5\OEMBIOS.CAT
这个问题用文字描述的话就是这样。
我电脑装了VOL版的XP,现在我想改成OEM版的, 我的主板具备了OEM特征, 我有一大堆OEMBIOS文件可用来替换系统所需要的文件。 为了查找准确的OEMBIOS文件, 我把它们放在一个个特定的文件夹中以便程序来自动寻找。
后来我想想能否再准确一点, 比如我在文件夹中放错了文件,我如果随便放在一个文件夹中呢?能否编个批处理快捷准确地找到呢?
问题就是这样来的。而且我发现这个问题也可以应用在别的地方, 类似的查找应用例子应该不少.
Last edited by quya on 2008-7-9 at 02:19 PM ]
Originally posted by 26933062 at 2008-7-9 01:41 PM:
It would be best to give some samples of the part of the crc.txt file...
I can't remember the samples, but this is a common issue.
F:\New Folder\xxx\OEMBIOS.CA_ Assume here expand F:\New Folder\xxx\OEMBIOS.CA_ %temp%\OEMBIOS.CAT
crc32 %temp%\OEMBIOS.CAT
Running result ??? 7B06BD13 ???? (just an example, may not be the actual one, ??? represents anything)
G:\WXPOEM\5\OEMBIOS.CAT
crc32 G:\WXPOEM\5\OEMBIOS.CAT
Running result ??? 162C7931 ????
To be universal, assume I first try to get the following a CRC file (actually this file may not be needed, as long as the final result, but let's take it step by step)
CRC.TXT
G:\I386\OEMBIOS.CA_ ???
G:\WXPOEM\1\OEMBIOS.CAT ??? (and so on)
G:\WXPOEM\2\OEMBIOS.CAT
G:\WXPOEM\3\OEMBIOS.CA_
G:\WXPOEM\4\OEMBIOS.CAT
G:\WXPOEM\5\OEMBIOS.CAT 162C7931
G:\WXPOEM\6\OEMBIOS.CAT
G:\WXPOEM\7\OEMBIOS.CAT
G:\WXPOEM\8\OEMBIOS.CAT
F:\cpl\thif\OEMBIOS.CA_
F:\New Folder\Acer\OEMBIOS.CA_
F:\New Folder\xxx\OEMBIOS.CA_ 7B06BD13
F:\New Folder\Lenovo\oembios.ca_
F:\New Folder\xx\OEMBIOS.CA_
Finally, what I want to get is something like the following result
LEGEND 7B06BD13 F:\New Folder\xxx\OEMBIOS.CA_
HEDY 162C7931 G:\WXPOEM\5\OEMBIOS.CAT
Describing this problem in words is like this.
My computer has a VOL version of XP installed, and now I want to change it to an OEM version. My motherboard has OEM characteristics, and I have a large number of OEMBIOS files available to replace the files needed by the system. In order to find the accurate OEMBIOS files, I put them in specific folders for the program to automatically find.
Then I thought whether it could be more accurate. For example, if I put the wrong file in the folder, if I just put it randomly in a folder? Can I compile a batch file to quickly and accurately find it?
The problem is like this. And I found that this problem can also be applied in other places, and there should be many similar application examples of finding.
Last edited by quya on 2008-7-9 at 02:19 PM ]
|

我怎么找不到一个比我注册日期早的人? 难道我是传说中的超级管理员? 其实我只是个潜水冠军而已. |
|
2008-7-9 13:53 |
|
|
26933062
银牌会员
    
积分 2268
发帖 879
注册 2006-12-19
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
说了一大堆,从1楼到6楼我都没明白你的意图到底是什么。
估摸着写了个代码。先看对不对吧。。。
注意:没考虑crc.txt中的文件名及路径含空格的情况,也没考虑1.txt内容第一列含空格的情况。
且crc.txt的???部分没有重复的前提下。
:
@echo off&setlocal enabledelayedexpansion
for /f "tokens=1* delims= " %%a in (1.txt) do set %%b=%%a
for /f "tokens=1,2 delims= " %%a in (crc.txt) do (
if defined %%b echo !%%b! %%b %%a
)
pause
Last edited by 26933062 on 2008-7-9 at 02:42 PM ]
After talking a lot, I didn't understand your intention from floor 1 to floor 6.
I guess I wrote a code. Let's see if it's correct...
Note: The situation where the file name and path in crc.txt contain spaces is not considered, and the situation where the first column of the content in 1.txt contains spaces is not considered.
And under the premise that there are no duplicates in the??? part of crc.txt.
:
@echo off&setlocal enabledelayedexpansion
for /f "tokens=1* delims= " %%a in (1.txt) do set %%b=%%a
for /f "tokens=1,2 delims= " %%a in (crc.txt) do (
if defined %%b echo !%%b! %%b %%a
)
pause
Last edited by 26933062 on 2008-7-9 at 02:42 PM ]
|

致精致简! |
|
2008-7-9 14:34 |
|
|
quya
高级用户
    五星老土
积分 558
发帖 172
注册 2003-2-9 来自 江苏
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
假如我运行 (为简化,先暂时不考虑OEMBIOS.CA_ 解压到临时目录OEMBIOS.CAT的问题 )
for /f %i in (2.txt) do crc32 %i >crc.txt
得到一个 crc.txt, 这个也是模拟的, 实际上可能不是这样简单, 但我会处理了.
3261089
9308173
2513351
4769779
2389039
162C7931
3468033
3351192
3627383
8631970
3820293
7B06BD13
4832250
8878816
第一个问题:
我如何把 2.txt 和 CRC.txt 合并成以下文件 temp.txt(如果能直接解决第2个问题,这个文件可以不要)
temp.txt (表中除了2个值是真实的,其他是我虚拟的)
路径 CRC值
G:\I386\OEMBIOS.CA_ 3261089
G:\WXPOEM\1\OEMBIOS.CAT 9308173
G:\WXPOEM\2\OEMBIOS.CAT 2513351
G:\WXPOEM\3\OEMBIOS.CA_ 4769779
G:\WXPOEM\4\OEMBIOS.CAT 2389039
G:\WXPOEM\5\OEMBIOS.CAT 162C7931
G:\WXPOEM\6\OEMBIOS.CAT 3468033
G:\WXPOEM\7\OEMBIOS.CAT 3351192
G:\WXPOEM\8\OEMBIOS.CAT 3627383
F:\cpl\thif\OEMBIOS.CA_ 8631970
F:\新建文件夹\Acer\OEMBIOS.CA_ 3820293
F:\新建文件夹\xxx\OEMBIOS.CA_ 7B06BD13
F:\新建文件夹\Lenovo\oembios.ca_ 4832250
F:\新建文件夹\xx\OEMBIOS.CA_ 8878816
第二个问题
如何根据 temp.txt 和 1.txt 通过一个共同的CRC值 得到如下文件
LEGEND 7B06BD13 F:\新建文件夹\xxx\OEMBIOS.CA_
HEDY 162C7931 G:\WXPOEM\5\OEMBIOS.CAT
第三个问题
不简化步骤,解决我的实际问题。
实际上,CRC只是个过渡,我只是通过CRC值找到我需要的特定文件的目录,而且这个特定文件可能是CAB压缩的在只读盘上,我不得不先解压再检测。如果不需要上面我说的复杂的步骤,那么再好也不过了。
我真正需要的最终结果类似下面的式样:
不限下面这2个值, 也可能只有一个值, 或者没找到无结果.
LEGEND F:\新建文件夹\xxx\OEMBIOS.CA_
HEDY G:\WXPOEM\5\OEMBIOS.CAT
Last edited by quya on 2008-7-9 at 04:10 PM ]
If I run (for simplicity, temporarily not considering the issue of extracting OEMBIOS.CA_ to the temporary directory OEMBIOS.CAT first)
for /f %i in (2.txt) do crc32 %i >crc.txt
Get a crc.txt, this is also simulated, actually it may not be that simple, but I will handle it.
3261089
9308173
2513351
4769779
2389039
162C7931
3468033
3351192
3627383
8631970
3820293
7B06BD13
4832250
8878816
First question:
How can I combine 2.txt and CRC.txt into the following file temp.txt (if the second question can be directly solved, this file can be omitted)
temp.txt (among the table, only 2 values are real, others are virtual by me)
Path CRC value
G:\I386\OEMBIOS.CA_ 3261089
G:\WXPOEM\1\OEMBIOS.CAT 9308173
G:\WXPOEM\2\OEMBIOS.CAT 2513351
G:\WXPOEM\3\OEMBIOS.CA_ 4769779
G:\WXPOEM\4\OEMBIOS.CAT 2389039
G:\WXPOEM\5\OEMBIOS.CAT 162C7931
G:\WXPOEM\6\OEMBIOS.CAT 3468033
G:\WXPOEM\7\OEMBIOS.CAT 3351192
G:\WXPOEM\8\OEMBIOS.CAT 3627383
F:\cpl\thif\OEMBIOS.CA_ 8631970
F:\New Folder\Acer\OEMBIOS.CA_ 3820293
F:\New Folder\xxx\OEMBIOS.CA_ 7B06BD13
F:\New Folder\Lenovo\oembios.ca_ 4832250
F:\New Folder\xx\OEMBIOS.CA_ 8878816
Second question
How to get the following file according to temp.txt and 1.txt through a common CRC value
LEGEND 7B06BD13 F:\New Folder\xxx\OEMBIOS.CA_
HEDY 162C7931 G:\WXPOEM\5\OEMBIOS.CAT
Third question
Do not simplify the steps, solve my actual problem.
Actually, CRC is just a transition, I just find the directory of the specific file I need through the CRC value, and this specific file may be in a CAB compression on a read-only disk, I have to decompress it first and then detect. If the complicated steps I mentioned above are not needed, then it is the best.
The final result I really need is similar to the following style:
There are no restrictions on the following 2 values, there may be only one value, or no result if not found.
LEGEND F:\New Folder\xxx\OEMBIOS.CA_
HEDY G:\WXPOEM\5\OEMBIOS.CAT
Last edited by quya on 2008-7-9 at 04:10 PM ]
|

我怎么找不到一个比我注册日期早的人? 难道我是传说中的超级管理员? 其实我只是个潜水冠军而已. |
|
2008-7-9 15:24 |
|
|
26933062
银牌会员
    
积分 2268
发帖 879
注册 2006-12-19
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
问题的关键在于运行crc32.exe 的结果到底是怎样的我们不知道。
你先运行下面的代码把结果帖出来看看。。
:
@echo off
for /f "delims=" %%a in (2.txt) do (
for /f "delims=" %%i in ('crc32 %%a') do echo %%i
)
pause
The key point is that we don't know what the result of running crc32.exe is.
You first run the following code and post the result to see.
:
@echo off
for /f "delims=" %%a in (2.txt) do (
for /f "delims=" %%i in ('crc32 %%a') do echo %%i
)
pause
|

致精致简! |
|
2008-7-9 16:16 |
|
|
terse
银牌会员
    
积分 2404
发帖 946
注册 2005-9-8
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
@echo off
for /f "delims=" %%j in (2.txt) do (
for /f "delims=" %%j in ('crc32 "%%i"') do (
for /f "delims=" %%k in ('findstr /ic:"%%j" "1.txt"') do (
if not "%%k"=="" echo %%k %%i
)
)
)
pause
```
@echo off
for /f "delims=" %%j in (2.txt) do (
for /f "delims=" %%j in ('crc32 "%%i"') do (
for /f "delims=" %%k in ('findstr /ic:"%%j" "1.txt"') do (
if not "%%k"=="" echo %%k %%i
)
)
)
pause
```
|

简单!简单!再简单! |
|
2008-7-9 16:19 |
|
|
quya
高级用户
    五星老土
积分 558
发帖 172
注册 2003-2-9 来自 江苏
状态 离线
|
『第 11 楼』:
使用 LLM 解释/回答一下
To: 9楼
我手头现在没CRC软件, 我要晚上才知道, 你假定最简单的好了, 就是 CRC32.EXE Filename 输出结果 CRC值, 因为不管CRC实际运行结果, 我都知道怎么处理,这个不是关键.
To: 10楼
下班之后我验证一下你的代码, 三个嵌套的 FOR, 看得我头晕, 可能你的代码在 OEMBIOS全部解压的情况下会正确运行, 但考虑压缩的OEMBIOS.CA_ , 情况就会复杂化, 能否先生成下中间文件, 让我解析一下, 以便解决实际问题.
谢谢大家了.
To: Floor 9
I don't have CRC software right now. I won't know until晚上. You can assume the simplest one, which is CRC32.EXE Filename outputs the CRC value. Because no matter the actual CRC running result, I know how to handle it. This isn't the key.
To: Floor 10
I'll verify your code after get off work. Three nested FORs make me dizzy. Maybe your code will run correctly when the OEMBIOS is fully decompressed, but considering the compressed OEMBIOS.CA_, the situation will be complicated. Can you generate the intermediate file first so that I can parse it to solve the actual problem?
Thank you everyone.
|

我怎么找不到一个比我注册日期早的人? 难道我是传说中的超级管理员? 其实我只是个潜水冠军而已. |
|
2008-7-9 16:45 |
|
|
quya
高级用户
    五星老土
积分 558
发帖 172
注册 2003-2-9 来自 江苏
状态 离线
|
『第 12 楼』:
使用 LLM 解释/回答一下
10楼的思路基本准确,我根据10楼的意思修改了第2个FOR 循环 验证了下。
@echo off
for /f "delims=" %%j in (2.txt) do (
for /f "delims=" %%j in (crc.txt) do (
for /f "delims=" %%k in ('findstr /ic:"%%j" "1.txt"') do (
if not "%%k"=="" echo %%k %%i
)
)
)
pause
运行结果是:(能否再完善并提高效率?谢谢!) %i 未正确显示路径! 我主要目的是取得路径.
HEDY 162C7931 %i
LEGEND 7B06BD13 %i
HEDY 162C7931 %i
LEGEND 7B06BD13 %i
HEDY 162C7931 %i
LEGEND 7B06BD13 %i
HEDY 162C7931 %i
LEGEND 7B06BD13 %i
HEDY 162C7931 %i
LEGEND 7B06BD13 %i
HEDY 162C7931 %i
LEGEND 7B06BD13 %i
HEDY 162C7931 %i
LEGEND 7B06BD13 %i
HEDY 162C7931 %i
LEGEND 7B06BD13 %i
HEDY 162C7931 %i
LEGEND 7B06BD13 %i
HEDY 162C7931 %i
LEGEND 7B06BD13 %i
HEDY 162C7931 %i
LEGEND 7B06BD13 %i
HEDY 162C7931 %i
LEGEND 7B06BD13 %i
HEDY 162C7931 %i
LEGEND 7B06BD13 %i
HEDY 162C7931 %i
LEGEND 7B06BD13 %i
请按任意键继续. . .
至于 CRC.TXT 文件的取得, 我初步的设想是下面代码, 未运行验证,可能要用到延迟变量之类的东东。
for /f %%i in (2.txt) do (if %~xi==cat crc32 %%i>>crc.txt else (expand %%i %temp%\oembios.cat &crc32 %temp%\oembios.cat>>crc.txt))
Last edited by quya on 2008-7-9 at 05:13 PM ]
The idea on floor 10 is basically accurate. I modified the second FOR loop according to the meaning of floor 10 and verified it.
@echo off
for /f "delims=" %%j in (2.txt) do (
for /f "delims=" %%j in (crc.txt) do (
for /f "delims=" %%k in ('findstr /ic:"%%j" "1.txt"') do (
if not "%%k"=="" echo %%k %%i
)
)
)
pause
The running result is: (Can it be further improved and made more efficient? Thanks!) %i is not displayed correctly as the path! My main purpose is to obtain the path.
HEDY 162C7931 %i
LEGEND 7B06BD13 %i
HEDY 162C7931 %i
LEGEND 7B06BD13 %i
HEDY 162C7931 %i
LEGEND 7B06BD13 %i
HEDY 162C7931 %i
LEGEND 7B06BD13 %i
HEDY 162C7931 %i
LEGEND 7B06BD13 %i
HEDY 162C7931 %i
LEGEND 7B06BD13 %i
HEDY 162C7931 %i
LEGEND 7B06BD13 %i
HEDY 162C7931 %i
LEGEND 7B06BD13 %i
HEDY 162C7931 %i
LEGEND 7B06BD13 %i
HEDY 162C7931 %i
LEGEND 7B06BD13 %i
HEDY 162C7931 %i
LEGEND 7B06BD13 %i
HEDY 162C7931 %i
LEGEND 7B06BD13 %i
HEDY 162C7931 %i
LEGEND 7B06BD13 %i
HEDY 162C7931 %i
LEGEND 7B06BD13 %i
Press any key to continue...
As for the acquisition of the CRC.TXT file, my preliminary idea is the following code, which has not been run and verified, and may need to use delayed variables and so on.
for /f %%i in (2.txt) do (if %~xi==cat crc32 %%i>>crc.txt else (expand %%i %temp%\oembios.cat &crc32 %temp%\oembios.cat>>crc.txt))
Last edited by quya on 2008-7-9 at 05:13 PM ]
|

我怎么找不到一个比我注册日期早的人? 难道我是传说中的超级管理员? 其实我只是个潜水冠军而已. |
|
2008-7-9 17:10 |
|
|
zh159
金牌会员
     
积分 3687
发帖 1467
注册 2005-8-8
状态 离线
|
『第 13 楼』:
使用 LLM 解释/回答一下
10 楼写错一个字符,所以 12 楼运行有点错误
@echo off
for /f "delims=" %%i in (2.txt) do (
for /f "delims=" %%j in ('crc32 "%%i"') do (
for /f "delims=" %%k in ('findstr /ic:"%%j" "1.txt"') do (
if not "%%k"=="" echo %%k %%i
)
)
)
pause
The 10th floor had a wrong character, so there was a little error when running on the 12th floor
@echo off
for /f "delims=" %%i in (2.txt) do (
for /f "delims=" %%j in ('crc32 "%%i"') do (
for /f "delims=" %%k in ('findstr /ic:"%%j" "1.txt"') do (
if not "%%k"=="" echo %%k %%i
)
)
)
pause
|

 |
|
2008-7-9 17:23 |
|
|
bat-zw
金牌会员
      永远的学习者
积分 3105
发帖 1276
注册 2008-3-8
状态 离线
|
『第 14 楼』:
使用 LLM 解释/回答一下
假设你的winrar存放路径是c:\progra~1\winrar\,如下:
@echo off&setloca enabledelayedexpansion
for /f %%a in (2.txt) do (
if "%%~xa" equ ".rar" (
call c:\progra~1\winrar\rar x %%a %%~dpa\
for /f "delim=" %%i in ('crc32 "%%~dpna.CA*"') do set str=%%i
) else (
for /f "delims=" %%i in ('crc32 "%%a"') do set str=%%i
)
echo !str! %%a>>crc.txt
)
rem 假定crc.exe *.*是如楼主所列出的形式
for /f "tokens=1,2" %%a in (crc.txt) do (
for /f "delims=" %%i in ('findstr "%%a" 1.txt') do echo %%i %%b
)
Last edited by zw19750516 on 2008-7-9 at 06:04 PM ]
Assume your WinRAR storage path is c:\progra~1\winrar\,as follows:
@echo off&setlocal enabledelayedexpansion
for /f %%a in (2.txt) do (
if "%%~xa" equ ".rar" (
call c:\progra~1\winrar\rar x %%a %%~dpa\
for /f "delim=" %%i in ('crc32 "%%~dpna.CA*"') do set str=%%i
) else (
for /f "delims=" %%i in ('crc32 "%%a"') do set str=%%i
)
echo !str! %%a>>crc.txt
)
rem Assume crc.exe *.* is in the form listed by the original poster
for /f "tokens=1,2" %%a in (crc.txt) do (
for /f "delims=" %%i in ('findstr "%%a" 1.txt') do echo %%i %%b
)
Last edited by zw19750516 on 2008-7-9 at 06:04 PM ]
|

批处理之家新域名:www.bathome.net |
|
2008-7-9 17:28 |
|
|
quya
高级用户
    五星老土
积分 558
发帖 172
注册 2003-2-9 来自 江苏
状态 离线
|
『第 15 楼』:
使用 LLM 解释/回答一下
Originally posted by zh159 at 2008-7-9 05:23 PM:
10 楼写错一个字符,所以 12 楼运行有点错误
不行, 路径名根本没用处. 即时J 改成 I 得到的是错误结果.
谢谢10楼和其他帮忙的朋友, 能否再看看. 我是横竖动不出脑筋了.
Originally posted by zh159 at 2008-7-9 05:23 PM:
There is a character error in floor 10, so there is a slight error when running in floor 12
No, the path name is completely useless. Even if J is changed to I, the result is wrong.
Thank you to floor 10 and other friends who helped. Can you take another look? I really can't figure it out.
|

我怎么找不到一个比我注册日期早的人? 难道我是传说中的超级管理员? 其实我只是个潜水冠军而已. |
|
2008-7-9 17:31 |
|