title: Batch commands to change IP and DNS
body: <p>I have written few commands in batch to execute them on choice basis. I am using 2 IP addresses for which I have to change IPv4 and DNS every time I switch between IPs.</p>
  
  <p>I have done this code and this works correctly if I execute line by line but in batch they give errors.</p>
  
  <pre><code>@ECHO OFF 
  SET /P no= Welcome dude so what are you up to press 1 for buzznet,2 for BSNL :
  
  IF "%NO%"=="1" GOTO BUZZ
  IF "%NO%"=="2" GOTO BSNL
  
  :BUZZ
  netsh interface ipv4 set address name="Ethernet" source=static ^
        addr=192.168.22.19 mask=255.255.255.0 gateway=192.168.22.1
  netsh interface ip add dns name="Ethernet" addr=192.168.18.1
  netsh interface ip add dns name="Ethernet" addr=8.8.8.8 index=2
  
  :BSNL
  netsh interface ip set address "Ethernet" dhcp
  netsh interface ip set dns “Ethernet” dhcp
  pause
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/3Smdq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3Smdq.png" alt="enter image description here"></a></p>