The FOR statement has the EOL option that specifies a character that indicates the line is to be ignored if it appears in the 1st position on a line. The default EOL character is ;
, so you don't have to do anything special to ignore lines that begin with ;
.
Your requirements are not very clear. I'm not sure what (if anything) you want to do with the section labels like [General]. I'm going to ignore them.
You can use FIND or FINDSTR to filter out any line that does not contain =
.
Here is a simple script that will load variables as defined by the .ini file. Lines that begin with ;
are comments. Section headers are ignored.
@echo off
for /f "delims=" %%A in ('findstr = example.ini') do %%A