이것을 쏴야합니다.
.bat확장명을 가진 파일을 만든 다음 bat 파일에 다음 코드를 넣고 파일 (명령 줄이 포함 된 file1.txt 및 암호가 포함 된 file2.txt)을 작성하고이 두 파일을 동일하게 넣으십시오. .bat 파일로 디렉토리.
그런 다음 파일을 실행하십시오. 작동하면 오류가 있는지 알려주십시오.
set replacestr=""
for /F "tokens=*" %%a in (file2.txt) do call :Foo %%a
goto End
:Foo
set replacestr=%1
call :innerloop
:innerloop
echo %replacestr%
call :FindReplace "......." %replacestr% file1.txt
exit /b
:FindReplace <findstr> <replstr> <file>
set tmp="%temp%\tmp.txt"
If not exist %temp%\_.vbs call :MakeReplace
for /f "tokens=*" %%a in ('dir "%3" /s /b /a-d /on') do (
for /f "usebackq" %%b in (`Findstr /mic:"%~1" "%%a"`) do (
echo(&Echo Replacing "%~1" with "%~2" in file %%~nxa
<%%a cscript //nologo %temp%\_.vbs "%~1" "%~2">%tmp%
if exist %tmp% move /Y %tmp% "%%~dpnxa">nul
)
)
del %temp%\_.vbs
exit /b
:MakeReplace
>%temp%\_.vbs echo with Wscript
>>%temp%\_.vbs echo set args=.arguments
>>%temp%\_.vbs echo .StdOut.Write _
>>%temp%\_.vbs echo Replace(.StdIn.ReadAll,args(0),args(1),1,-1,1)
>>%temp%\_.vbs echo end with
Get-Content,Out-File및replace.