@ECHO OFF
@setlocal enabledelayedexpansion
SET InFile=test.txt
FOR /F "tokens=*" %%A IN ('FINDSTR "wordA" "%InFile%" ^| FINDSTR "wordB"') DO CALL :FindString "%%A"
pause
:FindString
SET String=%~1
SET String=%String:*wordA =%
SET String=%String: wordB=`%
FOR /F "tokens=1 delims=`" %%A IN ('%String%') DO ECHO %%A
在这里,我刚刚编写了一个代码,用我想要的字符替换这个词。当我运行这些代码时,我收到错误消息。这时候出乎意料