C#winform修改IP,dns
///
private void setDHCP()
{
string _doscmd = "netsh interface ip set address 本地连接 DHCP";
Process p = new Process();
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;
p.Start();
p.StandardInput.WriteLine(_doscmd.ToString());
_doscmd = "netsh interface ip set dns 本地连接 DHCP";
p.StandardInput.WriteLine(_doscmd.ToString());
p.StandardInput.WriteLine("exit");
}
/// 设置IP地址,掩码,网关等
///
private void setIPaddress()
{
string _ipaddress = "192.168.111.222";
string _submask = "255.255.255.0";
string _gateway = "192.168.111.1";
string _dns1 = "123.1.11.1";
string _doscmd = "netsh interface ip set address 本地连接 static " + _ipaddress + " " + _submask + " " + _gateway + " 1";
Process p = new Process();
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;
p.Start();
p.StandardInput.WriteLine(_doscmd.ToString());
_doscmd = "netsh interface ip set dns 本地连接 static " + _dns1;
p.StandardInput.WriteLine(_doscmd.ToString());
p.StandardInput.WriteLine("exit");
}
C#winform修改IP,dns的更多相关文章
- Linux修改IP,DNS和网关
以Red Hat Enterprise Linux 5.2为例1.最常用的给网卡配置ip的命令为 #ifconfig eth0 192.168.0.1 netmask 255.255.255.0 up ...
- CentOS(RedHat)命令行永久修改IP地址、网关、DNS
1.修改IP地址vim /etc/sysconfig/network-scripts/ifcfg-eth0DEVICE=eth0 #网卡名称BOOTPROTO=static #获取ip的方式(stat ...
- CentOS 设置网络(修改IP&修改网关&修改DNS)--update.14.08.15
自己电脑上装的虚拟机用桥接方式连接物理机,虚拟机重启后ip会发生变化,非常阻碍Xshell的连接和hosts指定的dns. 通过修改IP为static模式,保持IP不变. ============== ...
- Linux命令行修改IP、网关、DNS的方法
Linux中在命令行中修改IP地址.网关.DNS的方法. 网卡eth0 IP修改为 102.168.0.1 复制代码代码如下: ifconfig eth0 102.168.0.1 netmask ...
- CentOS 修改IP地址, DNS, 网关
一.CentOS 修改IP地址 修改对应网卡的IP地址的配置文件# vi /etc/sysconfig/network-scripts/ifcfg-eth0 修改以下内容DEVICE=eth0 #描述 ...
- linux下修改ip地址,默认网关以及DNS
*修改IP地址 即时生效: ifconfig eth0 192.168.1.100 netmask 255.255.255.0 重启生效: vim /etc/sysconfig/network-s ...
- 让Linux修改IP、DNS等可以更简单
修改IP: 可以用 netconfig,可惜每次都得输入完整的IP.掩码.网关和DNS. 不如直接 vi /etc/sysconfig/network-scripts/ifcfg-eth0 再 /et ...
- Ubuntu Server修改IP、DNS、hosts
本文记录下Ubuntu Server 16.04修改IP.DNS.hosts的方法 -------- 1. Ubuntu Server 修改IP sudo vi /etc/network/interf ...
- linux 修改IP, DNS 命令
linux 修改IP, DNS 命令 http://www.cnblogs.com/fighter/archive/2010/03/04/1678007.html 修改DNS [root@localh ...
随机推荐
- Css控制div水平垂直居中显示
<style>#info{height:0px; width:0px;top:50%; left:50%;position:absolute;}#center{background:#FF ...
- vi 快捷键【转】【weber整理必出精品】
光标的移动 命令 光标移动 h或^h 向左移一个字符 j或^j或^n 向下移一行 k或^p 向上移一行 l或空格 向右移一个字符 G 移到文件的最后一行 nG 移到文件的第n行 w 移到下一个字的开头 ...
- MD5 Tool 工具类
package com.example.secret.tools; import java.io.UnsupportedEncodingException; import java.security. ...
- cell的各种使用和赋值 总结
cell可以分为:自定义cell,系统的cell ,cell的自适应,.xib的cell //第一种cell:系统cell 在 UIViewController下创建UITableView //1.0 ...
- 列表:一个打了激素的数组3 - 零基础入门学习Python012
列表:一个打了激素的数组3 让编程改变世界 Change the world by program 列表的一些常用操作符 比较操作符 逻辑操作符 连接操作符 重复操作符 成员关系操作符 ...... ...
- [Codeforces Round #237 (Div. 2)] A. Valera and X
A. Valera and X time limit per test 1 second memory limit per test 256 megabytes input standard inpu ...
- php----浅谈一下empty isset is_null的用处
} } { } { } } } { } { } is_null():判断变量是否为null if ($a){} 那这个未声明变量会报noti ...
- Flume Channel
http://blog.csdn.net/john_f_lau/article/details/20913831 http://dev.cmcm.com/archives/194
- AOI
AOI(Automatic Optic Inspection)的全称是自动光学检测,是基于光学原理来对焊接生产中遇到的常见缺陷进行检测的设备.AOI是新兴起的一种新型测试技术,但发展迅速,很多厂家都推 ...
- 【转】android4.1.2 CTS测试总结
原文网址:http://blog.csdn.net/bboyliaoye/article/details/17299259 公司客户的产品要过google GMS认证,首先要过的就是兼容性测试(CTS ...