Wind7 Batch Set IP (script)

Source: Internet
Author: User
Tags goto

Wind7 Batch Set IP (script)

Description: Fill in your own IP address at the x.x.x.x.

Save as a ". bat" file and run as an administrator.

The code is as follows:

@echo off

: Main

Cls

echo please follow the instructions ...

Echo.

Echo 1 Sti-hust

Echo 2 dian-hust-711

Echo 3 DHCP

Echo 4 Exit

Echo.

set/p choice= Input A number:

Echo.

If "%choice%" = = "1" goto Ip_sti

If "%choice%" = = "2" goto ip_dian711

If "%choice%" = = "3" goto IP_DHCP

If "%choice%" = = "4" goto Ip_exit

Goto Main

: Ip_sti

echo IP Automatic setting ...

Echo.

echo updates IP and subnet masks

netsh interface ip set address name= "Local Area Connection" Source=static addr=x.x.x.x mask=x.x.x.x gateway=x.x.x.x gwmetric=1

echo Update DNS Server

netsh interface ip set DNS name= "Local Area Connection" Source=static addr=x.x.x.x register=primary

netsh interface ip add DNS name= "Local Area Connection" addr=x.x.x.x

echo Settings complete

Pause

Exit

if errorlevel 2 goto main

if errorlevel 1 goto end

: ip_dian711

echo IP Automatic setting ...

Echo.

echo updates IP and subnet masks

netsh interface ip set address name= "Local Area Connection" Source=static addr=x.x.x.x mask=x.x.x.x gateway=x.x.x.x gwmetric=1

echo Update DNS Server

netsh interface ip set DNS name= "Local Area Connection" Source=static addr=x.x.x.x register=primary

netsh interface ip add DNS name= "Local Area Connection" addr=x.x.x.x

echo Settings complete

Pause

Exit

if errorlevel 2 goto main

if errorlevel 1 goto end

: Ip_dhcp

netsh interface ip set address name= "Local Area Connection" Source=dhcp

netsh interface ip set DNS name= "Local Area Connection" Source=dhcp

netsh interface ip set wins name= "Local Area Connection" Source=dhcp

echo Settings complete

Pause

Exit

if errorlevel 2 goto main

if errorlevel 1 goto end

: Ip_exit

Exit

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.