Windows バッチファイルでテキストファイルにある文字列を置換したい sample_input.txt に「"foo"」という文字列(「"」も文字列)が出現したら「"boo"」という文字列に置換するsample_output.txt に出力する (既にファイルが存在する場合は上書きする) ○ テキストファイルにある「"foo"」という文字列を「"boo"」という文字列に置換したい ■ ローカル変数版 @echo off set ofilename=sample_output.txt type nul >%ofilename% setlocal ENABLEDELAYEDEXPANSION for /f "delims=" %%A in (sample_input.txt) do ( set line=%%A echo !line:"foo"="boo"!>>%ofilename% )