ipアドレス切替バッチスクリプト
1543 ワード
ipアドレス切替バッチスクリプトは、変更すればIPアドレス切替器になります.もしあなたが2つのネットワークを使っているなら、私は会社でそうしています.
コード:
コード:
@echo off
rem # ----------------------------------
rem # IP
rem # ----------------------------------
echo "=========IP =========="
echo "=> d: IP"
echo "=> h: IP :66.168.1.8"
echo "=> r: IP :192.168.250.173"
echo " d,h,r, : "
set /p ch=
if %ch%=="" echo "You input null"&goto :EOF
set case=d,h,t,w>nul
echo %case%|findstr "\<%ch%\>">nul&if errorlevel 1 goto :err
goto %ch%
goto err
:h
:: " "
echo "configure home ip address gateway,please wait 30 second ..."
@netsh int ip set address " " static 66.168.1.8 255.255.255.0 66.168.1.1 1 >nul
@netsh int ip set dns " " static 66.168.1.1 PRIMARY >nul
echo home ip configure is done
goto :EOF
:r
:: " " ( www.jbxue.com)
echo "configure transport ip address gateway,please wait 30 second ..."
@netsh int ip set address " " static 192.168.250.173 255.255.255.0 192.168.250.1 1 >nul
echo transport ip configure is done
goto :EOF
:d
:DHCP " IP "
echo "configure transport ip address gateway,please wait 30 second ..."
@netsh int ip set address " " dhcp >nul
@netsh int ip set dns " " dhcp >nul
:err
:: "error"
echo your input "%ch%" ,no this argument ! please input h or w! game over
rem # IP