Every time on-line, we must first on the grayscale environment and then to the formal environment. In a grayscale environment, access to the grayscale environment is achieved by automatically acquiring the IP and changing the specified DNS. Concrete how to realize, we can Baidu by ourselves.
Create a new text document, change the suffix to bat, open the file, and copy the code:
@echo off: StartEcho============Please enter a number to select the next action:Echo============1: IP is set to grayscaleEcho============2: IP set to original IPSet/P var= ":"if%var%==1GotoIP10if%var%==2Gotoip172: Ip10CLSnetsh interface ipSetAddress Name= "Local Area Connection" source=dhcpnetsh Interface IP Delete DNS"Local Area Connection"Allipconfig/Flushdnscmd/C netsh interface ipSetDNS name= "Local Area Connection" Source=static addr=192.168.0.216 register=PrimaryEcho**ip set to grayscale, set success * *Echo ------------------------------------------Goto Start: ip172CLSnetsh interface ipSetAddress Name= "Local Area Connection" Source=static addr=192.168.1.132 mask=255.255.255.0 gateway=192.168.3.254cmd/C netsh interface ipSetDNS name= "Local Area Connection" Source=static addr=180.76.76.76 register=Primarycmd/C netsh interface ip add DNS name= "Local Area Connection" addr=8.8.8.8 index=2Echo**ip set to 192.168.1.132, Set success * *Echo ------------------------------------------Goto Start
Save exit, double click to run, the effect is as follows:
To view the network configuration, the IP has been changed.
You can add statements yourself if you have more requirements in real life.
Gadget for automatically changing IP under Windows (Bat batch file)