Wind7 batch processing IP (script)

  
        Description: Fill in your own IP address at x.x.x.x. Save it as a “.bat” file and run as an administrator. The code is as follows: @echo off:mainclsecho Please follow the prompts...echo.echo 1 STI-HUSTecho 2 Dian-HUST-711echo 3 DHCPecho 4 Exitecho.set /p choice= Input a number:echo.if "%choice% "=="1" goto ip_STIif "%choice%"=="2" goto ip_Dian711if "%choice%"=="3" goto ip_DHCPif "%choice%"==" ;4" goto ip_Exitgoto main:ip_STIecho IP auto-setting...echo.echo update IP and subnet mask netsh interface ip set address name="local connection" source=static addr=xxxx mask=xxxx gateway=xxxx Gwmetric=1echo update DNS server netsh interface ip set dns name="local connection" source=static addr=xxxx register=PRIMARYnetsh interface ip add dns name="local connection" addr=xxxxecho set finish pauseexitif errorlevel 2 goto Mainif errorlevel 1 goto end :ip_Dian711echo IP auto-setting...echo.echo update IP and subnet mask netsh interface ip set address name="local connection" source=static addr=xxxx mask =xxxx gateway=xxxx gwmetric=1echo Update DNS server netsh interface ip set dns name="local connection" source=static addr=xxxx register=PRIMARYnetsh interface ip add dns name="local connection" addr=xxxxecho settings Complete pauseexitif errorlevel 2 goto mainif errorlevel 1 goto end :ip_DHCPnetsh interface ip set address name="local connection" source=dhcpnetsh interface ip set dns name="local connection" source=dhcpnetsh interface ip set wins name=" Local connection " source=dhcpecho setting to finish pauseexitif errorlevel 2 goto mainif errorlevel 1 goto end :ip_Exitexit
Copyright © Windows knowledge All Rights Reserved