How to locate the unkown string value

Microsoft Windows server 2003 enterprise
January 28, 2010 at 08:52:18
Specs: Windows XP

How can I write a batch file to locate the unknown string value in a known location within a text file? For example, i know the location is
Password = <thevalueIdontknowatfirstplacebutneedtoretrieve>

line [MIKE] and line Password = will never be changed. It's the password string value I need to retrieve, and, change it to a value I will provide.

Thanks for the help.

See More: How to locate the unkown string value

Report •

January 28, 2010 at 09:51:52
@echo off > newfile & setLocal enableDELAYedeXpansion

set /p NEW-PW= provide new PW

for /f "tokens=* delims= " %%a in (myfile) do (
set S=%%a
if "!Q!" equ "Y" (
set S=!S:~0,10! !NEW-PW!
set Q=
if "!S!" equ "[MIKE]" set Q=Y
>> newfile echo !S!

Helping others achieve escape felicity


Report •

January 28, 2010 at 10:04:44
Thanks a lot. I'm new to this so do you mind to explain a little bit of the code?

Report •

Related Solutions

Ask Question