|
Answer» Hi guys, what's up?
Well, I did find a post here in the forum about this question, quite similar to what I wanna do, but it's too old so I opened a new thread. so, the problem is: I have a folder with hundreds of XML files and I WANT to replace text inside them, in this CASE 076E3626449684B8D6E099B2093C5AE5 for 0ABE3626449684B8ABCDEFB2093C5AE5. And after that, I want to save the files with the original name, and if possible overwrite the files (the OUTPUT name must be the input name). Here's what I've tried:
@echo off for /f "tokens=* delims=" %%f in ('type *.xml') do CALL :DOREPLACE "%%f"
GOTO :EOF :DOREPLACE SET INPUT=%* SET OUTPUT=%INPUT:076e3626449684b8d6e099b2093c5ae5=077e3626449684b8d6e099b2093c5ae5%
for /f "tokens=* delims=" %%g in ('ECHO %OUTPUT%') do ECHO %%~g>>%output.xml
EXIT /b
As you can see, the line "for /f "tokens=* delims=" %%g in ('ECHO %OUTPUT%') do ECHO %%~g>>%output.xml" generates an output file with name "output.xml". I want this name to be the same name that I receive in the input. Is it possible??
Thanks, see ya later. SED is a better tool than batch for replacing text.
Are you able to download GNUsed and USE that?
|