Computing.Net > Forums > Programming > set result of FINDSTR in FOR

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

set result of FINDSTR in FOR

Reply to Message Icon

Name: david_brown3020
Date: March 18, 2009 at 13:57:16 Pacific
OS: Windows 2003
Subcategory: Batch
Comment:

Hi,
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

Thanks,
....David.



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: March 18, 2009 at 14:40:15 Pacific
Reply:

@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.

M2


0

Response Number 2
Name: david_brown3020
Date: March 18, 2009 at 14:53:38 Pacific
Reply:

M2,
Thank you so much for your accurate and speedy solution!
....David.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


batch file to edit/copy l... internet explorer



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: set result of FINDSTR in FOR

batch file: error SETting in FOR /f www.computing.net/answers/programming/batch-file-error-setting-in-for-f/16520.html

Show size of HDD in Mb using batch www.computing.net/answers/programming/show-size-of-hdd-in-mb-using-batch/17383.html

DOS - result of command used in if statement www.computing.net/answers/programming/dos-result-of-command-used-in-if-statement/19202.html