Installing a driver(.inf) file from command line

时间秒杀一切 提交于 2019-12-03 09:38:52

问题


I am working in windows 8.1. I need to install a driver file(.inf file) from command line. Which command i need to use.? I know i have many other method for installing a .inf file, but i must install this from command line.

Please help me Thanks in advance...


回答1:


Granger's comment works in Windows 7 too. According to MS, PnPUtil (PnPUtil.exe) is included in every version of Windows, starting with Windows Vista.

It is useful for device drivers that do not have default install (right-click "Install" does not work for them).

pnputil -i -a <driverinf>




回答2:


There are many variants ... and many complications with newer versions of Windows.

But for starters, try something like this:

rundll32.exe advpack.dll,LaunchINFSectionEx myinf.inf,,c:\temp\mydata.cab,36

  • http://www.msfn.org/board/topic/104891-how-can-i-install-a-inf-file-from-the-command-line/

  • http://msdn.microsoft.com/en-us/library/aa768006%28v=vs.85%29.aspx

  • Programmatic driver install via .inf causing reboot

Note: beware older links that suggest "setupapi" instead of "advpack". You definitely want advpack.dll.




回答3:


The default way for device drivers is:

pnputil -i -a <driverinf>

Legacy Drivers can´t be installed with pnputil and have to use LaunchINFSectionEx-Call

I tested the following and it works with several drivers from Windows 2000 up to Windows 10, 2012R2, 2016, 2019.

rundll32.exe advpack.dll,LaunchINFSectionEx ykmd.inf,Yubico64_Install.NT,,4,N

Pay attention to use the correct section

The correct section of the inf-File must be used, when there is no [DefaultInstall]-Section. This lacks in most answers. Look it up in your drivers inf-File and use the correct section (in my example "Yubico64_Install.NT"). Using the wrong section wont prompt an error. Im my example I use Quiet mode, no UI (4) and Never reboot (N) to install the driver automated via GPO. All options are documented in detail here:

https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/aa768006(v%3Dvs.85)



来源:https://stackoverflow.com/questions/22496847/installing-a-driver-inf-file-from-command-line

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!