我試圖用enabledelayedexpansion讀取文件enabledelayedexpansion .File包含enabledelayedexpansion的特殊character.Because!之後的文本將被忽略。請提出一些解決此問題的方法。 注意: - 我必須使用enabledelayedexpansion。如何處理!在批量
`
@echo off
set "search1='"
set "search2=""
set "search3=&"
set "search4=<"
set "search5=>"
set "search6=!"
set "replace1='"
set "replace2=""
set "replace3=&"
set "replace4=<"
set "replace5=>"
set "replace6=^!"
setlocal enabledelayedexpansion
set "textfile=!input!"
set "newfile=!input!1"
echo !textfile!
echo !newfile!
break>"!newfile!"
(for /f "delims=" %%i in (!textfile!) do (
setlocal enabledelayedexpansion
set "line=%%i"
for /f "usebackq tokens=1,2 delims=$" %%a in ('"!search3!"$"!replace3!"') do set "line=!line:%%~a=%%~b!"
for /f "usebackq tokens=1,2 delims=$" %%a in ('"!search4!"$"!replace4!"') do set "line=!line:%%~a=%%~b!"
for /f "usebackq tokens=1,2 delims=$" %%a in ('"!search5!"$"!replace5!"') do set "line=!line:%%~a=%%~b!"
for /f "usebackq tokens=1,2 delims=$" %%a in ('"!search2!"$"!replace2!"') do set "line=!line:%%~a=%%~b!"
for /f "usebackq tokens=1,2 delims=$" %%a in ('"!search1!"$"!replace1!"') do set "line=!line:%%~a=%%~b!"
setlocal enabledelayedexpansion
echo(!line!
endlocal
))>>"!newfile!"
以上僅僅是腳本的一部分。文本文件將包含文件path.rest所有替代工作正常,只有在情況下!其造成的問題
編輯。希望這給你的問題的答案 – ABC