Need to search and edit a line using batch fi

Microsoft Windows server standard 2008 -...
May 11, 2010 at 04:28:18
Specs: Windows Server 2003/2008, 2 GB
Hi,

I want to search below string in a text file
"java.txt":

ProcessName=$PROACTIVEHOME\jre\bin\jav
a_agent

If it exists replace this line with

ProcessName=$PROACTIVEHOME\jre64\bin\j
ava_agent

Please suggest how to do this using batch file.


See More: Need to search and edit a line using batch fi

Report •

#1
May 11, 2010 at 04:58:14
@echo off > newfile & setLocal enableDELAYedeXpansion

for /f "tokens=* delims= " %%a in (java.txt) do (
set S=%%a
echo !S! | find "ProcessName=$PROACTIVEHOME\jre\bin\java_agent" > nul
if not errorlevel 1 (
set S=!S:jre=jre64!
)
>> newfile echo.!S!
)


=====================================
Helping others achieve escape felicity

M2


Report •

#2
May 11, 2010 at 05:04:21
Thanks Dear

Report •
Related Solutions


Ask Question