bat设置IP

@echo OFF
ipconfig |find "172"
@if %ERRORLEVEL% EQU 0 (
netsh interface IP set address "Wireless Network Connection" source=dhcp
netsh interface IP set dns "Wireless Network Connection" source=dhcp
)else netsh int ip set add name="Wireless Network Connection" static 172.19.21.131 255.255.0.0  && route add 192.9.0.0 mask 255.255.0.0 172.19.21.254


CMB in shenzheng
===============
ipconfig |findstr 99.1.84.253// this is the gatway
if %ERRORLEVEL%==0 (//if not found
netsh interface IP set address "Local Area Connection" static 99.1.68.4 255.255.255.0 gateway=99.1.68.253 1
netsh interface IP set dns "Local Area Connection" static addr=202.96.134.133
pause
) else (
netsh interface IP set address "Local Area Connection" static 99.1.84.4 255.255.255.0 gateway=99.1.84.253 1
netsh interface IP set dns "Local Area Connection" static addr=99.1.34.22
pause
)

你可能感兴趣的:(bat)