title: Batch script for loop & nslookup
body: <p>I've seen this question posted before, but none of the solutions address my issue.  I'm simply trying to iterate through a text file that contains host names.  When I try the same command (omitting the extra percent signs) from the command line, it will work once or twice then then give the error noted below.  Running it as a batch file, the batch file exits without doing anything. This one has really stumped me.</p>
  
  <p>Here's the code in my batch file:</p>
  
  <pre><code>@echo off
  set OUTPUTFILE=Results/Results.txt
  set lookup=HostNames.txt
  FOR /F %%i in (%lookup%) do 
  FOR /F "usebackq skip=3 delims=: tokens=2" %j in (`nslookup %i`) 
  do @echo %%i %%j &gt;&gt; %OUTPUTFILE%
  </code></pre>
  
  <p>At a command line I get:</p>
  
  <blockquote>
    <p>i`) was unexpected at this time.</p>
  </blockquote>
  
  <p>When I run it at a command line I am taking out the additional percent signs needs when it runs in a batch file.  I'm also using absolute                   paths at the command line, to ensure it this isn't an issue with the environment variables I've set.</p>