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.