title: Command Prompt Read Variable from file and put inside a Loop
body: <p>I am trying to achieve something that using Command Prompt, I have some understanding on command prompt code but however I feel quite confusing and need explanation on it.</p>
  
  <p>What I am trying to achieve is </p>
  
  <p>1) Read variable from a text file, for example:</p>
  
  <ul>
  <li>Host1.domain.com</li>
  <li>Host2</li>
  <li>Comp1.sub.domain.com</li>
  <li>Example4</li>
  </ul>
  
  <p>2) After getting this variable, put inside a command, let say Ping (each open up in a separate command window):</p>
  
  <ul>
  <li>Ping Host1.domain.com</li>
  <li>ping host2</li>
  <li>ping comp1.sub.domain.com</li>
  <li>ping example4</li>
  </ul>
  
  <p>3) However I do not want a simple Ping, I want those hostname being put inside a Loop (the Loop is inside that separate command window previously):</p>
  
  <p>:loop<br>
  ping Host1.domain.com<br>
  goto loop        </p>
  
  <p>I am aware that I can use ping -t, however this is just an example, and ping -t won't do the job, as I want to test DNS resolution, I have other script that keep flushing DNS and using loop.</p>
  
  <p>Thank you for in advance for anyone that can help.</p>
  
  <p>Thanks</p>