我要禁用所有网络适配器:
我看到这可以通过系统命令netsh来完成。
当我运行下面的命令时,我得到了一个错误。
C:\Windows\system32>netsh interface set interface name="Local Area Connection 2" admin=DISABLED
Area is not an acceptable value for connect.
The parameter is incorrect.似乎命令行解析器无法获取空格。如果使用单引号(而不是双引号),也会发生同样的情况。
我需要你的帮助大师。
顺便说一句,我的代码是C#,我尝试了许多来自网络的例子,但都没有成功。
System.Diagnostics.ProcessStartInfo psi =
new System.Diagnostics.ProcessStartInfo(
"netsh",
"interface set interface name=\"" + interfaceName + "\" admin=enabled");
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo = psi;
bool result = p.Start(); 发布于 2014-05-21 17:25:01
我使用
netsh interface set interface "Local Area Connection 2" ENABLED它对我来说工作得很好,并且启用了“本地连接2”。
也许你可以在你的代码中使用这种方式,这对你来说是应该的。
https://stackoverflow.com/questions/14424338
复制相似问题