get driver version via command line Windows
Is there a possibility to get the installed driver VERSION via command line on a Windows 7 system.
I've already tried driverquery
but there is no information about the Version of the drivers, only a Linkdate. (By the way, what does that Link Date mean?)
I don't want tools or programs. I need a cmd line command.
Or can I get the version out of the registry?
Is there a possibility to get the installed driver version via command line
You can use the following PowerShell Script:
Get-WmiObject Win32_PnPSignedDriver | select devicename, driverversion
Example output:
PS F:\test> Get-WmiObject Win32_PnPSignedDriver| select devicename, driverversion
devicename driverversion
---------- -------------
Generic volume 6.1.7601.17514
Generic volume 6.1.7601.17514
Generic volume shadow copy 6.1.7600.16385
Generic volume shadow copy 6.1.7600.16385
Generic volume shadow copy 6.1.7600.16385
Generic volume shadow copy 6.1.7600.16385
Generic volume shadow copy 6.1.7600.16385
Generic volume shadow copy 6.1.7600.16385
Generic volume shadow copy 6.1.7600.16385
Generic volume 6.1.7601.17514
Generic volume 6.1.7601.17514
Generic volume 6.1.7601.17514
Volume Manager 6.1.7601.17514
Microsoft Virtual Drive Enumerator Driver 6.1.7601.17514
Cruzer 6.1.7600.16385
UMBus Enumerator 6.1.7601.17514
UMBus Enumerator 6.1.7601.17514
UMBus Root Bus Enumerator 6.1.7601.17514
Atheros Bluetooth Bus 6.30.1208.302
Plug and Play Software Device Enumerator 6.1.7601.17514
Terminal Server Mouse Driver 6.1.7601.17514
Terminal Server Keyboard Driver 6.1.7601.17514
WAN Miniport (SSTP) 6.1.7601.17514
WAN Miniport (PPTP) 6.1.7601.17514
WAN Miniport (PPPOE) 6.1.7601.17514
...
You can use VBScript or JScript to get what you want. Since you didn't say for which driver you wanted the version number, here's a batch / JScript hybrid script that dumps them all to the console for you. Save this as driverversion.bat
:
@if (@a==@b) @end /*
:: batch portion
@echo off
setlocal enabledelayedexpansion
for /f "delims=" %%I in ('driverquery /v /nh /fo csv') do (
set idx=0
for %%x in (%%I) do (
set /a "idx+=1"
if !idx!==1 (
set /p "=%%~x version "<NUL
) else if !idx!==14 (
if exist "%%~x" (
cscript /nologo /e:jscript "%~f0" "%%~x"
) else echo N/A
)
)
)
goto :EOF
:: JScript portion */
WSH.Echo(new ActiveXObject("Scripting.FileSystemObject").GetFileVersion(WSH.Arguments(0)));
You can use driverquery /v
to include the driver files with the listing, but AFAICS you won't be able to get the version number from the files without additional software. One tool you could use would be sigcheck
from SysIntern^WMicrosoft.
@echo off
for /f "delims=, tokens=14" %%d in ('driverquery /v /nh /fo csv') do (
for /f %%v in ('sigcheck -accepteula -q -n "%%~d"') do (
echo %%~d %%~v
)
)
You can't get the version out of the registry, because the information is stored in the file itself.
The link date is probably the date when the file was linked, i.e. the creation date.
Here an improved version to list all drivers include version using Sigcheck from Sysinternals Tools:
@echo off
for /f "tokens=* delims=" %%a in ('driverquery /v /nh /fo csv') do (
SET str=%%a
SETLOCAL enabledelayedexpansion
SET str=!str:","=";"!
for /f "tokens=1,2,14 delims=;" %%d in (!str!) do (
ENDLOCAL
for /f "tokens=* delims=" %%v in ('sigcheck -accepteula -q -n "%%f"') do (
REM echo %%a,^"'%%v^"
echo ^"%%d,%%e,%%f,^"'%%v^"
REM echo ^"%%d,^"'%%v^"
)
)
)
pause
An extended version which writes the information directly to an csv file:
@echo off
set DRIVER_LOG="Drivers_%computername%.csv"
echo Drivers - %computername% - %date% > %DRIVER_LOG%
for /f "tokens=* delims=" %%a in ('driverquery /v /nh /fo csv') do (
SET str=%%a
SETLOCAL enabledelayedexpansion
SET str=!str:","=";"!
for /f "tokens=1,2,14 delims=;" %%d in (!str!) do (
ENDLOCAL
for /f "tokens=* delims=" %%v in ('sigcheck -accepteula -q -n "%%f"') do (
REM echo %%a,^"'%%v^" >> %DRIVER_LOG%
echo ^"%%d,%%e,%%f,^"'%%v^" >> %DRIVER_LOG%
REM echo ^"%%d,^"'%%v^" >> %DRIVER_LOG%
)
)
)
pause
Some variants are possible...
...for all details, please use:
echo %%a,^"'%%v^"
...for more details, please use (default):
echo ^"%%d,%%e,%%f,^"'%%v^"
...for short information, please use:
echo ^"%%d,^"'%%v^"
Annotation: If you open the created csv file in Excel and want to hide the text sign ' use
Find: "'" and Replace with: "'" in Excel (Yes, it's really the same!)
This script was tested with Windows XP and Windows 7!
(For Windows XP use an older version of Sigcheck! e.g. Sigcheck v2.02)