我对批处理文件的了解有限,所以请原谅我,如果我对你的答案有任何解释:)无论如何,这里有问题:我有一个包含ISBN号的文本文件,这对应于我硬保存的XML驾驶。我想知道如何:
<related-object content-type="pdf.partial" object-type="application/pdf" specific-use="data" xlink:href="999999999999999toc_pv-viii_CBO.pdf"/><related-object content-type="image.extract" object-type="image/jpeg" specific-use="data" xlink:href="9999999999999_abstract_CBO.jpg"/>
然后记录下来:
我将一些命令复制/粘贴到另一个批处理文件中,但我无法再通过任何文件了。
@ECHO off
set file_list=%CD%\count_list.txt
if not exist "%CD%\count_list.txt" (
ECHO Error: count_list.txt not found.
ECHO Creating count_list.txt
ECHO 2>count_list.txt >nul`
ECHO Done
ECHO Use count_list.txt to list the files to be read.
goto :han
)
CLS
ECHO 1) Count words.
ECHO 2) Exit.
ECHO.
CHOICE /C 12 /M "Press a number:"
CLS
IF ERRORLEVEL 2 Exit
IF ERRORLEVEL 1 GOTO bilang
:bilang
if not exist "%CD%\count.log" GOTO :hill
del "%CD%\count.log"
:hill
set /p src_folder="%~1Enter Source Folder: "
set /p matchWord="%~1Enter string to count: "
for /f "delims=" %%f in (%file_list%) do (
if exist "%src_folder%\%%f*" (
ECHO %%f Result:
)>>xerox.log else (
ECHO %%f does not exist
)
for /f %%C in ('Find /C "%matchWord%" ^< %src_folder%\%%f*') do (
set Count=%%C
echo Result = %Count% >> count.log
echo Result = %Count%
)
)
:han
pause
在那里,我真的试图让它发挥作用,但这就是我所拥有的。但有一件事是我想到的。查找所有字符串并为每个字符串添加回车符,然后使用find选项计算所有出现的事件。那可能吗?这只是我的意见。任何答案都将非常感谢,谢谢你们! :)