Created
April 20, 2017 15:35
-
-
Save maravedi/8a99f04a58208a6a82627e2919c01ba7 to your computer and use it in GitHub Desktop.
Batch Script to Change from Static IP to DHCP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
echo Choose: | |
echo [A] Set Static IP to XX.XX.XX.XX | |
echo [B] Set DHCP | |
echo ================================ | |
:choice | |
SET /P C=[A or B]? | |
if [%C%]==[A] goto A | |
if [%C%]==[B] goto B | |
goto choice | |
:A | |
@echo off | |
echo Setting static IP address: XX.XX.XX.XX | |
netsh interface ip set address "Local Area Connection" static XX.XX.XX.XX 255.255.255.0 XX.XX.XX.YY | |
netsh interface ip add dns "Local Area Connection" addr="8.8.4.4" | |
netsh interface ip add dns "Local Area Connection" addr="8.8.8.8" | |
netsh interface ip show config "Local Area Connection" | |
pause | |
goto end | |
:B | |
@echo off | |
echo Enabling DHCP | |
netsh interface ip set address "Local Area Connection" source=dhcp | |
netsh interface ip set dnsservers "Local Area Connection" source=dhcp | |
netsh interface ip show config "Local Area Connection" | |
pause | |
goto end | |
:end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment