home   articles   tags   browse code   

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


readconfig.bat
@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%


 

Tags: windows, batch
 
Eugene on Apr 23rd, 2011 11:51 am said:
Thanks a lot for the post!!!
 

Karasuro on Feb 2nd, 2012 10:29 pm said:
I'm trying to create a mod switcher for Minecraft using DOS. Here's my code so far: http://pastebin.com/BLHQGs69 I need help with using batch to write to a .ini file. Code for writing to .ini starts on line 370. WARNING: running the .bat WILL install directories in your AppData folder.
 



 

 



Related Articles
 



home  |  privacy policy  |  terms of use  |  contact  


©2012, Zedwood.com

zedwood.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to amazon.com