Created
December 16, 2015 06:02
-
-
Save saurabhwahile/ea4d2933f988dc8e7b1d to your computer and use it in GitHub Desktop.
Switch gateway, Ex: for failover/redundancy
This file contains hidden or 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 | |
for /f "tokens=2,3 delims={,}" %%a in ('"WMIC NICConfig where IPEnabled="True" get DefaultIPGateway /value | find "I" "') do set gateway=%%~a | |
IF %gateway%==192.168.1.1 ( | |
netsh interface ip set address name="Wi-Fi" static 192.168.1.10 255.255.255.0 192.168.1.41 1 | |
) ELSE ( | |
netsh interface ip set address name="Wi-Fi" static 192.168.1.10 255.255.255.0 192.168.1.1 1 | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment