title: Windows Batch: How to add Host-Entries?
body: <p>I want to use this batch script to add new entries into my host file automatically by using <a href="/questions/tagged/windows" class="post-tag" title="show questions tagged &#39;windows&#39;" rel="tag">windows</a> batch.</p>
  
  <p>Unfortunately, the script <strong>just adds one single line to the hosts file</strong>, also when i run the script as a administrator, so what's wrong?</p>
  
  <pre><code>@echo off
  
  set hostspath=%windir%\System32\drivers\etc\hosts
  
  echo 62.116.159.4 ns1.intranet.de &gt;&gt; %hostspath%
  echo 217.160.113.37 ns2.intranet.de &gt;&gt; %hostpath%
  echo 89.146.248.4 ns3.intranet.de &gt;&gt; %hostpath%
  echo 74.208.254.4 ns4.intranet.de &gt;&gt; %hostpath%
  
  exit
  </code></pre>