我希望批處理文件搜索?符號並將其替換爲txt文件中的%符號要搜索的批處理文件?並在txt文件中用%替換它
我看到很多搜索和替換代碼,它不會被替換嗎?與%
如果任何一個有代碼,它工作在VBS張貼
例如:
@echo off
setlocal
set "search=?"
set "replace=%"
set "textfile=test.txt"
set "newfile=newtest.txt"
(for /f "delims=" %%i in ('findstr /n "^" "%textfile%"') do (
set "line=%%i"
setlocal enabledelayedexpansion
set "line=!line:%search%=%replace%!"
echo(!line!
endlocal
))>"%newfile%"
type "%newfile%" > nul
@Mofi - 只是發佈這個答案。儘管我不確定OP是否想要新文件中的行號 – npocmaka 2014-08-31 21:21:49
thankyou mofi它是工作! – user3752270 2014-08-31 21:28:05