title: Batch File: How to read only sections in a INI file
body: <p>I am very much a novice at Batch Scripting and i'm trying to write a simple script to READ from an INI file based on the Parameters that is passed when the batch file is called.</p>
  
  <p>This is an example for what the INI file would look like:</p>
  
  <pre><code>[SETTING1]
  Value1=Key1
  Value2=Key2
  Value3=Key3
  
  [SETTING2]
  Value1=Key1
  Value2=Key2
  Value3=Key3
  
  [SETTING3]
  Value1=Key1
  Value2=Key2
  Value3=Key3
  </code></pre>
  
  <p>I am running into a problem when it comes to reading ONLY the section that is called. It will read from any section that matches the "Value" and "Key" and i don't know how to limit it to only read the section with the settings.</p>
  
  <p>The file is being called with this Parameter: run.bat run.ini setting2. My code below is what I have so far and I feel as if i have officially hit a wall. Can anyone help with this? Any help would greatly be appreciated.</p>
  
  <pre><code>    @ECHO OFF
  SETLOCAL ENABLEDELAYEDEXPANSION
  SET INIFile="%~f1"
  
  for /f "usebackq delims=" %%a in (!INIFile!) do (
          if %%a==[%2] (
          SET yesMatch=%%a
              for /f "tokens=1,2 delims==" %%a in (!yesMatch!) do (
                  if %%a==Value1 set Key1=%%b
                  if %%a==Value2 set Key2=%%b
                  if %%a==Value3 set Key3=%%b
  )
          ECHO !yesMatch!
          ECHO !Key1!
          ECHO !Key2!
          ECHO !Key3!
          pause
  )
  )
  
  pause
  exit /b
  </code></pre>