Replacing a line in a Txt

March 7, 2010 at 19:41:22
Specs: Windows 7
Hi,
could you please help me with a problem. I would like to edit a line in a .txt file (named test.txt) This is what i got so far:

@echo off > newfile & setLocal enableDELAYedeXpansion
for /f "tokens=* delims= " %%a in (qsc.ini) do (
set S=%%a
set S=!S:bob=qwerty!
>> newfile echo.!S!
)
move /y newfile test2.txt

It works fine but i want to replace "bob" and "qwerty" with strings that have '=' in it and when i do that the script doesn't work how i want it to.

Thank you in advance


See More: Replacing a line in a Txt

Report •

#1
March 7, 2010 at 21:57:22
"escape" the equals sign, since it is "special" to script:
^=

try that...


Report •

#2
March 7, 2010 at 22:22:37
where do i put it?
set S=!S:name=bob=name=jimmy!

========================
Pie tastes better on a Monday
========================


Report •

#3
March 7, 2010 at 22:28:42
Oh i just found out how to bypass the problem by this:
"set S=!S:bob=jimmy!"
since the "name=" will always be there i could just do the name.

Thank you for your help thou.

========================
Pie tastes better on a Monday
========================


Report •
Related Solutions


Ask Question