BATCH - Read Config.ini


When formatted a certain way, config.ini files can be read by NT batch scripts (windows).

I have to give credit where credit is due. Google found this one for me, and I am including a sample batch file here for reference. [http://www.computing.net]

config.ini
username=owner
password=mypass
@echo off
for /f "tokens=1,2 delims==" %%a in (config.ini) do (
if %%a==username set username=%%b
if %%a==password set password=%%b
)
 
echo %username%
echo %password%



code snippets are licensed under Creative Commons CC-By-SA 3.0 (unless otherwise specified)

Eugene on 2011-04-23 17:51:53
Thanks a lot for the post!!!

Noah on 2014-04-30 14:21:05
Very nice thank you

zzoIKENIozz on 2015-11-29 00:37:01
tnx

on 2017-04-13 14:10:57
Thank you!