windows 通过批处理文件卸载驱动程序

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20572076/
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-09 11:11:01  来源:igfitidea点击:

Uninstalling a driver via batch file

windowsbatch-filedriveruninstallrunonce

提问by tronious

I'm looking for information on whether or not there is a Windows standard way for accomplishing this?

我正在寻找有关是否有 Windows 标准方法来完成此操作的信息?

Essentially we have a vendor who has updated their driver and devices running our software must be updated automatically.

本质上,我们有一个供应商更新了他们的驱动程序,并且运行我们软件的设备必须自动更新。

In order to do this, we must uninstall the existing driver first (vendor requirement).

为此,我们必须先卸载现有驱动程序(供应商要求)。

Any guidance on best practices/approach to doing so. Details of why this needs to be done are probably not important. It just needs to be done.

有关这样做的最佳实践/方法的任何指导。为什么需要这样做的细节可能并不重要。它只需要完成。

Also a sample would be very helpful.

一个样本也会非常有帮助。

Thanks

谢谢

采纳答案by Knuckle-Dragger

WMIC is best choice for accomplishing this via command line.

WMIC 是通过命令行完成此操作的最佳选择。

wmic sysdriver where name="drivernamehere" call delete

devcon.exe is another alternative for batch.

devcon.exe 是批处理的另一种选择。

http://support.microsoft.com/kb/311272

http://support.microsoft.com/kb/311272

EDIT: Use this to get find the correct name

编辑:使用它来找到正确的名称

wmic sysdriver get name

回答by Nilus Dionis

wmic sysdriver where "name=drivernamehere" call delete

wmic sysdriver where "name=drivernamehere" 调用删除

The syntax above appears to be incorrect. I tried and always got "delete - Invalid alias verb" I looked up the syntax and came up with the following that appears to work:

上面的语法似乎不正确。我尝试并总是得到“删除 - 无效的别名动词”我查找了语法并提出了以下似乎有效的方法:

wmic sysdriver where name="driver_name" delete

wmic sysdriver where name="driver_name" 删除

I got instance deletion successful but I have to verify whether this completely removes the driver from the system or not.

我成功删除了实例,但我必须验证这是否从系统中完全删除了驱动程序。

回答by Thomas Barber

Actually, the correct syntax should be as follows:

实际上,正确的语法应该如下:

wmic sysdriver where(name="driver_name") delete