Set IP and DNS acquisition method to manual#
netsh interface ip set address name="Ethernet" source=static addr=192.168.50.138 mask=255.255.255.0 gateway=192.168.50.100
netsh interface ip set dns "Ethernet" static 192.168.50.100 primary
Set IP and DNS acquisition method to DHCP#
netsh interface ip set address name="Ethernet" source=dhcp
netsh interface ip set dns name="Ethernet" source=dhcp
Create script#
- Create a bat script and enter the following content
- Send to desktop shortcut
- Right-click - Properties - Shortcut - Advanced - Run as administrator
- Run the script