Use. NET implementation IP switcher

Source: Internet
Author: User

1. Introduction

Often in the company, customers and home, switching IP is a daily thing to do, so the intention to develop a small application to achieve IP address shortcut switching. Now that you've got the idea to do it, the first thing I think about is applying the Netsh.exe tool, so configure a batch file to implement the Netsh.exe command, and then use the. NET Framework to invoke the bat file. Words have come to this, to act immediately.

2. Basic Principles

According to the above solution idea, my small system, named "Anytao.iphelper" solution is as follows:

Loading the Netsh.exe command with batch file to realize IP loading;

Using the. NET process method to implement the call to the external application;

Comes with progress control and file retrieval functions.

Therefore, it is necessary for the system to run the principle of a simple comb, the ins and outs, uncover the essence.

Introduction to 2.1. netsh tools

Long-term netsh command introduction, this is not specifically introduced, Baidu can easily find more detailed netsh command manual, you can spend one day of kung fu to study, since this article focuses on the application, from the actual moves to elaborate, detailed martial arts cheats to reader tailored, Here is only reference: netsh command details, netsh command usage.

In this article, refer to the following steps to implement your Netsh command processor:

Open Notepad and enter the following information:

@echo Anytao is switching your ip now.
@echo off
netsh interface ip set address 本地连接 static 172.1.1.226 255.0.0.0 172.30.7.254 1
netsh interface ip set dns 本地连接 static 200.121.5.1
echo ...www.anytao.com...
Echo Congratulations, done.
pause

Note: Enter your IP, subnet mask, default gateway, and DNS server address in the format listed above, and if it is an English version of the operating system, change "local Area Connection" to "Connection".

Save the text as a batch file, save as: Home.bat.

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.