Guest User

Untitled

a guest
Nov 2nd, 2008
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 0.65 KB | None | 0 0
  1. @echo off
  2. REM -- Prepare the Command Processor --
  3. SETLOCAL ENABLEEXTENSIONS
  4. SETLOCAL DISABLEDELAYEDEXPANSION
  5.  
  6. ::BatchSubstitude - parses a File line by line and replaces a substring"
  7. ::syntax: BatchSubstitude.bat OldStr NewStr File
  8. ::          OldStr [in] - string to be replaced
  9. ::          NewStr [in] - string to replace with
  10. ::          File   [in] - file to be parsed
  11. if "%*"=="" findstr "^::" "%~f0"&GOTO:EOF
  12. for /f "tokens=1,* delims=]" %%A in ('"type %3|find /n /v """') do (
  13.     set "line=%%B"
  14.     if defined line (
  15.         call set "line=echo.%%line:%~1=%~2%%"
  16.         for /f "delims=" %%X in ('"echo."%%line%%""') do %%~X
  17.     ) ELSE echo.
  18. )
Advertisement
Add Comment
Please, Sign In to add comment