multiple find and replace

March 29, 2009 at 16:17:36
Specs: Windows XP
I want to be able to find and replace a text string in all files in all subfolders starting at a particular location e.g. replace "xyz" with "abc" in all files and subfolders in c:\test

See More: multiple find and replace

Report •

March 30, 2009 at 03:27:26
:: replace string in all files

@echo off & setLocal EnableDelayedExpansion

pushd c:\test

for /f "tokens=* delims=" %%a in ('dir/s/b/a-d') do (
type nul > #
for /f "tokens=* delims=" %%i in (%%a) do (
set str=%%i
set str=!str:xyz=abc!
echo !str! >> #
copy # %%a

If at first you don't succeed, you're about average.


Report •
Related Solutions

Ask Question