windows 以编程方式连接和断开 USB 设备

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/764999/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 12:19:24  来源:igfitidea点击:

Connect and disconnect USB devices programmatically

c#.netwindowsusb

提问by

I need to connect and disconnect USB devices, such as flash drives, in a programmatical manner, without unplugging and re-plugging the device.

我需要以编程方式连接和断开 USB 设备(例如闪存驱动器),而无需拔下和重新插入设备。

Is there any way to do it in a C# Windows application?

有没有办法在 C# Windows 应用程序中做到这一点?

回答by Shalom Craimer

You might want to look at some related questions:

您可能想查看一些相关问题:

Both of the approaches mentioned in the answers are readily translatable to C#.

答案中提到的两种方法都可以轻松转换为 C#。