title: Batch script - Ignore hash when reading lines from a file
body: <p>I would like to set variables from name value pairs in a properties. The property file has # for comments</p>
  
  <p>====sample input file=====</p>
  
  <pre><code>#This is a comment
  ### Another comment
  appNames=HelloWorldApp
  targetServer=serverABC
  
  DEV.key1=value1
  TEST.key2=value2
  </code></pre>
  
  <p>=========
   I have 2 issues</p>
  
  <p>1)</p>
  
  <pre><code>C:\temp\dos&gt;for /f "delims=" %i in (test.properties) do @set %i
  Environment variable #This is a not defined
  Environment variable ### Another not defined
  </code></pre>
  
  <p>Variables are set, but I would like comments to be ignored. I would like to do this with a single line of code, but get this instead.</p>
  
  <pre><code>for /f "delims=" %i in (test.properties) do @echo %i | find "#"&gt;nul || @set %i
  find: unable to access "#": The system cannot find the file specified.
  The process tried to write to a nonexistent pipe.
  Environment variable #This is a not defined
  find: unable to access "#": The system cannot find the file specified.
  The process tried to write to a nonexistent pipe.
  </code></pre>
  
  <p>2)
  I would like this properties file to be passed as an argument to a batch script.Contents of the test.bat file</p>
  
  <pre><code>set propFilePathAndName=%1
  for /f "delims=" %i in (%propFilePathAndName%) do echo %i
  </code></pre>
  
  <p>output</p>
  
  <pre><code>C:\temp\dos&gt;set propFilePathAndName=/temp/dos/test.properties
  propFilePathAndNamei was unexpected at this time.    
  </code></pre>
  
  <p>If I run the contents of this file one line at a time , it works. 
  What am I doing wrong?
  Thanks in advance</p>