在 Windows Server 2008 r2 中禁用网络适配器的 C++ 示例 [英] C++ example to disable a network adapter in Windows server 2008 r2

查看:91
本文介绍了在 Windows Server 2008 r2 中禁用网络适配器的 C++ 示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Windows Server 2008 R2 上,我们有多个网络适配器.我们有一个必须与特定网络适配器绑定的旧程序.它并不总是选择正确的.我需要禁用不正确的网络适配器,然后启动程序,然后再次启用网络适配器.我在禁用适配器时遇到问题.有人可以提供 C++ 示例吗?编译器为Embarcadero C++ XE2.

On Windows Server 2008 R2 we have multiple network adapters. We have a legacy program that has to bind with a particular network adapter. It does not always select the correct one. I need to disable the incorrect network adapters, then start the program and then enable the network adapters again. I am having trouble disabling the adapters. Could someone provide a C++ example? The compiler is Embarcadero C++ XE2.

推荐答案

我认为没有必要使用 C++.批处理文件可以做到.

I think it is not necessary to use c++. Batch file can do it.

文件如下:

禁用界面运行:

netsh interface set interface "Local Area Connection" DISABLED

启用界面运行:

netsh interface set interface "Local Area Connection" ENABLED

这篇关于在 Windows Server 2008 r2 中禁用网络适配器的 C++ 示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆