Advertisement
Guest User

Untitled

a guest
Aug 30th, 2016
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. @echo off
  2. rem カレントディレクトリ移動(バッチ実行ディレクトリ)
  3. cd /d %~dp0
  4.  
  5. rem 入力ファイル
  6. set infilenm=input.txt
  7. rem 出力ファイル
  8. set outfilenm=output.txt
  9. rem 置換前文字列
  10. set beforestr=foo
  11. rem 置換後文字列
  12. set afterstr=bar
  13.  
  14. rem 出力ファイル作成
  15. type nul >%outfilenm%
  16.  
  17. rem ファイル編集
  18. setlocal enabledelayedexpansion
  19. for /f "delims=" %%A in (%infilenm%) do (
  20. set line=%%A
  21. echo !line:%beforestr%=%afterstr%!>>%outfilenm%
  22. )
  23. endlocal
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement