title: Get current DNS server used by using Batch code?
body: <p><strong>Language: BATCH (USED IN WINDOWS)</strong></p>
  
  <p>How are you able to get the current DNS server address that you are using? I only need the primary server address, but if you are able to get secondary and tertiary DNS addresses, that would be <em>much</em> help too.</p>
  
  <p>I've already figured out 1 way, and it works good.</p>
  
  <pre><code>nslookup &gt;dnsnames.txt
  findstr Address dnsnames.txt
  </code></pre>
  
  <p>The only thing I don't know what to do with is how to remove the "Address" word that is prior to the DNS address that you are using (You'll see what I mean by typing in <code>nslookup</code> in the Command Line. Here's what I mean: <a href="http://imgur.com/QzcgmIw" rel="nofollow">http://imgur.com/QzcgmIw</a></p>
  
  <p>I've seen how you can remove the "Address" and leave the wanted DNS Address behind
  by using FOR /F but that command boggles my mind, So there's no other way but this. You can explain to me how FOR works though.</p>
  
  <pre><code>Address: 192.168.0.1
  </code></pre>
  
  <p>This is just for the people who don't understand me yet. I want to remove "Address" but leave "192.168.0.1" behind. <em>How</em> can I do that? Also, how may I put the remaining "192.168.0.1", Which is my DNS server , into a VARIABLE?</p>
  
  <p>By the way, This is just a snip of code I want to use in a program that checks internet components. For the full code: <a href="http://pastebin.com/RQQkpQ94" rel="nofollow">http://pastebin.com/RQQkpQ94</a></p>
  
  <p>If you have some suggestions or answers, please post below. If there is something wrong with my question, Since I'm new here, Notify me. Thanks!</p>