Saturday 16 August 2008

Batch programming tip #16 (part 2): getting property values from an ini file

This is just a slight variation on the previous post on working with *.ini files.
Here we only retrieve property values but not sections or property names.

@echo off
setlocal enabledelayedexpansion

:init_vars
set ini_file=my.ini
goto show_values

:show_values
for /F "tokens=1,2 delims==" %%L in (%ini_file%) do (
if not [%%M]==[] (
echo Value: %%M
)
)
goto eof

:eof
echo Press any key to quit
pause > NUL


Simple :-).

Thoughts?

No comments:

Online Marketing
Add blog to our blog directory blog search directory Blog Directory Blogarama - The Blog Directory