On Thu, 3 Jul 2003 16:38:20 +0200, "Black" <(E-Mail Removed)> wrote:
>I need a batch file to change specified line in txt file.
>
>I have a file like this
>
>.
>.
>.
>[win32client.dll]
>comdll=sqlws32
>[win32client.ws32]
>serverpath=SCentura,192.168.1.3,2155/*
>.
>.
>.
>
>
>and I need a batch file to replace line
>"serverpath=SCentura,192.168.1.3,2155/*" to
>"serverpath=SCentura,888.888.888.888,2155/*"
>
>Can somebody help me?
@echo off
setlocal
set filename=c:\folder\filename.xxx (the full path to your file)
if exist %TEMP%\replace.tmp del /q %TEMP%\replace.tmp
for /f "Tokens=*" %%a in ('type %filename%') do set line=%%a&call

arse
del /q %filename%
copy %TEMP%\replace.tmp %filename%
del /q %TEMP%\replace.tmp
endlocal
goto :EOF

arse
set work=%line:"=%
if /i "%work%" EQU "serverpath=SCentura,192.168.1.3,2155/*" goto replace

ut
@echo %line%>>%TEMP%\replace.tmp
goto :EOF
:replace
set line="serverpath=SCentura,888.888.888.888,2155/*"
goto out
Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com