title: Create batch script to edit host file by network connection
body: <p>I want to use this batch script to add new entries into my host file automatically by using windows batch.</p>
  
  <p>I want to edit host file only when i m in office. I want to say like that:
  if(network name=='OfficeWifi') do changes...</p>
  
  <pre><code>@echo off
  
  set hostspath=%windir%\System32\drivers\etc\hosts
  // if(network name=='OfficeWifi')
  echo 81.155.145.48 ns1.intranet.de &gt;&gt; %hostspath%
  
  exit
  </code></pre>
  
  <p>thx for your help</p>