Batch file setting var. from .ini

May 28, 2011 at 16:12:15
Specs: Windows 7
I had this code before (contents of variables.ini below):

@echo off
setLocal EnableDelayedExpansion
for /f "tokens=* delims= " %%a in (variables.ini) do (
set /a N+=1
set v!N!=%%a
)
set username=!v2!
set password=!v3!
set address=!v4!
set s1=!v5!
set s1a=!v6!
set s2=!v7!
set s2a=!v8!
set s3=!v9!
set s3a=!v10!
set s4=!v11!
set s4a=!v12!
set s5=!v13!
set s5a=!v14!

But for example, the variable username is coming up as username=username, and I want it to come up as username (after username=). Please give me a new code. Thanks in advance.

Contents of variables.ini:

Variables
username=username
password=password
address=C:\
server1name=Server #1
server1address=server1
server2name=Server #2
server2address=server2
server3name=Server #3
server3address=server3
server4name=Server #4
server4addressserver4
server5name=Server #5
server5address=localhost


See More: Batch file setting var. from .ini

Report •

#1
June 19, 2011 at 10:27:11
change it to

Variables.txt

username
password
C:\
Server #1
server1
Server #2
server2
Server #3
server3
Server #4
server4
Server #5
localhost

mike


Report •

#2
June 20, 2011 at 08:16:33
Try:

or /f "tokens=2 delims=="

When your only tool is a hammer, every problem looks like a nail.


Report •
Related Solutions


Ask Question