set result of FINDSTR in FOR

March 18, 2009 at 13:57:16
Specs: Windows 2003
I need to extract the result of the follwing to a new variable called "DominoServiceName"

for %%T in ("c:\program files\lotus\domino\notes.ini") do findstr "ServiceName" %%T

The output of the FINDSTR in the FOR statement is:

ServiceName=Lotus Domino Server (ProgramFilesLotusDominodata)

I just want to set the part after "ServiceName=" to DominoServiceName


See More: set result of FINDSTR in FOR

Report •

March 18, 2009 at 14:40:15
@echo off & setLocal EnableDelayedExpansion

::pushd "c:\program files\lotus\domino"

for /f "tokens=1* delims==" %%a in ('find "ServiceName" ^< notes.ini') do (
set DominoServiceName=%%b
echo !DominoServiceName!

If at first you don't succeed, you're about average.


Report •

March 18, 2009 at 14:53:38
Thank you so much for your accurate and speedy solution!

Report •

Related Solutions

Ask Question