C# 启用 禁用 本地连接

  1. 1 static void Enable(string interfaceName)
  2. 2 {
  3. 3 System.Diagnostics.ProcessStartInfo psi =
  4. 4 new System.Diagnostics.ProcessStartInfo("netsh", "interface set interface \"" + interfaceName + "\" enable");
  5. 5 System.Diagnostics.Process p = new System.Diagnostics.Process();
  6. 6 p.StartInfo = psi;
  7. 7 p.Start();
  8. 8 }
  9. 9
  10. 10 static void Disable(string interfaceName)
  11. 11 {
  12. 12 System.Diagnostics.ProcessStartInfo psi =
  13. 13 new System.Diagnostics.ProcessStartInfo("netsh", "interface set interface \"" + interfaceName + "\" disable");
  14. 14 System.Diagnostics.Process p = new System.Diagnostics.Process();
  15. 15 p.StartInfo = psi;
  16. 16 p.Start();
  17. 17 }
  18. 18 static List<Task> list = new List<Task>();
  19. 19 public static void Main(string[] str)
  20. 20 {
  21. 21 Disable("本地连接");
  22. 22 Console.ReadKey();
  23. 23 Enable("本地连接");
  24. 24 }

C# 启用禁用本地连接

C# snaps的更多相关文章

  1. saving snaps iteratively with for loop in Paraview

    Goal: read data 1 and slice, then save pressure, velocity contours, close data, then do loop for the ...

  2. zookeeper源码分析之一服务端启动过程

    zookeeper简介 zookeeper是为分布式应用提供分布式协作服务的开源软件.它提供了一组简单的原子操作,分布式应用可以基于这些原子操作来实现更高层次的同步服务,配置维护,组管理和命名.zoo ...

  3. win7 安装好redis 如何安装扩展

    首先我的电脑环境是使用的是wamp集成开发环境,PHP版本5.5.12的 安装要找对应的扩展,不然会出问题 php_redis.dll下载地址:http://windows.php.net/downl ...

  4. php中redis的安装

    1.当你在使用php时出现下面的问题 2.通过phpinfo()查看php的版本 我的是php5.6版本 3.查看需要下载的redis的版本 4.点击下面的额链接下载redis:http://wind ...

  5. Redis在windows环境下ThinkPHP的安装和使用

    1.Redis概述: 2.Redis在windows环境下的安装: 下载地址:https://github.com/dmajkic/redis/downloads,选取其中一个zip压缩包:

  6. ORACLE等待事件: log file parallel write

    log file parallel write概念介绍 log file parallel write 事件是LGWR进程专属的等待事件,发生在LGWR将日志缓冲区(log_buffer)中的重做日志 ...

  7. PHPExcel中文开发手册翻译版(2)

    2016年8月18日12:45:14 请注意这个是粗翻译版,仅供参考,不是精校版 精校版后面才会更新 PHPExcel开发者文档 1.目录 2. 4先决条件 2.1.软件要求4 2.2.安装说明4 2 ...

  8. windows 下安装redis并且测试(php)

    Window 下安装 下载地址:https://github.com/dmajkic/redis/downloads. 下载到的Redis支持32bit和64bit.根据自己实际情况选择,将64bit ...

  9. windows下安装php5.5的redis扩展

    windows下开发用的xampp集成的环境,想装个php-redis扩展,扩展的github地址:  https://github.com/nicolasff/phpredis php_redis. ...

  10. php redis 安装篇(windows 7)

    人人都说redis比memcached好,但是没有实际体验过,概念还是比较模糊,今天就先把redis安装好,后面的体验再分享,由于php已经有了很好的扩展库支持,所以redis安装非常方便,下面是wi ...

随机推荐

  1. 客户端发送信息给服务器以及服务器接收客户端发来的信息(socket)

    服务器端: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data ...

  2. 尺取法 C - Vasya and String CodeForces - 676C

    C - Vasya and String CodeForces - 676C #include<iostream> using namespace std; int main() { lo ...

  3. Python爬取亚马逊商品页面

    仍然利用Requests库来实现 1 import requests 2 r=requests.get('https://www.amazon.cn/gp/product/B01M8L5Z3Y') 3 ...

  4. 新的学习历程-python4 input

    1 num = input("请输入数字:") # input用于录入键盘输入 2 print(num) 3 print(type(num)) #input获取到数据类型是字符类型 ...

  5. doskey: windows版 Alias

    1.编辑doskey.bat文件 2.打开注册表寻找.HKEY_CURRENT_USER \ Software \ Microsoft \ Command Processor (自行百度) 3.添加d ...

  6. Linux 搭建Apache(httpd)服务

    简介:Apache HTTP Server是开源软件项目,基于标准的HTTP网络协议提供的网页浏览服务,http是Apache服务器的主程序,它是一个独立的后台进程. 1. 安装 A. 安装httpd ...

  7. SAR成像(六):距离徙动矫正

    1.什么是距离徙动? 距离徙动产生原因是合成孔径雷达的运动平台与目标之间的相对运动.对于地面一静止的点目标,当它处于雷达波束照射范围内的时间中时,随着飞行载体的运动,它与雷达飞行载体之间的距离会不断的 ...

  8. JustAuth-第三方登录组件

    1.新增依赖 <dependency> <groupId>me.zhyd.oauth</groupId> <artifactId>JustAuth< ...

  9. Linux 命令 diff

    比较两个文件不同 $ diff file1 file2 比较两个目录不同 $ diff --brief --recursive dir1/ dir2/ --brief 仅显示有无差异,不显示详细的信息 ...

  10. C++ CLI string

    String^ to std::string ` include <msclr\marshal_cppstd.h> marshal_as(String^) `