关于重复备份能处理掉,但这样做效率低处理时间长,虽然是重复但备份的驱动文件很少出现重复的情况。
WHQL数字签名呢我是读取oem*.inf提取相应的.cat来弥补devcon的不足,而且最后把oem*.inf和oem*.cat改名成inf内容里相同的文件名,这样才能保证再次更新时WHQL数字签名是有效的,而驱动精灵只提取了cat文件没有把.inf改名成对应的文件名造成再次更新时WHQL数字签名是无效的,也就是驱动精灵最大的不足。
比如我的创新声卡inf内容是
驱动安装后文件是以oem2.inf和oem2.cat保存在系统目录,备份好不改名成ECTIVA.inf和ECTIVA.cat,再次更新驱动时WHQL数字签名是无效的,驱动精灵只能做到oem2.inf和ECTIVA.cat
改名代码
for /f "tokens=1* delims== " %%k in ('type "%inf%"^|find /i ".cat"') do set oemname=%%~nl
if defined oemname for /f "delims=*" %%k in ('dir /s /b /a-d "%SystemRoot%\system32\CatRoot\%infname%.cat" 2^>nul') do set catfile=%%~k
if not defined catfile for /f "delims=*" %%k in ('dir /s /b /a-d "%SystemRoot%\%oemname%.cat" 2^>nul') do set catfile=%%k
if defined catfile (
set infname=%oemname%
xcopy /h /r /y "%catfile%" "drivers\%class%\%name%\*.*">nul 2>>%log%
if errorlevel 0 color 0e&&echo 含WHQL数字签名
attrib -s -h -r "drivers\%class%\%name%\%infname%.*">nul
move /y "drivers\%class%\%name%\%infname%.inf" "drivers\%class%\%name%\%oemname%.inf">nul 2>nul
move /y "drivers\%class%\%name%\%infname%.cat" "drivers\%class%\%name%\%oemname%.cat">nul 2>nul
)
for /f "delims= " %%i in ('devcon hwids %ID%^|sed -n "/Hardware ID's:/{n;p;}"') do echo "%infname%.inf"****"%%~i">>"drivers\HardwareID.log"
WHQL数字签名呢我是读取oem*.inf提取相应的.cat来弥补devcon的不足,而且最后把oem*.inf和oem*.cat改名成inf内容里相同的文件名,这样才能保证再次更新时WHQL数字签名是有效的,而驱动精灵只提取了cat文件没有把.inf改名成对应的文件名造成再次更新时WHQL数字签名是无效的,也就是驱动精灵最大的不足。
比如我的创新声卡inf内容是
; ECTIVA Audio 5.1 Series INF file
;
; Feature : Enhanced (WDM)
; Language : English
;
; Date : 12 Feb 2004
; Revision : 1.00.003
;
; Copyright 1995-2004, Creative Technology Ltd.
Signature="$CHICAGO$"
Class=MEDIA
ClassGUID={4d36e96c-e325-11ce-bfc1-08002be10318}
provider=%MfgName%
CatalogFile=ECTIVA.cat
DriverVer=02/12/2004,5.12.01.004
%MfgName%=ECTIVA
驱动安装后文件是以oem2.inf和oem2.cat保存在系统目录,备份好不改名成ECTIVA.inf和ECTIVA.cat,再次更新驱动时WHQL数字签名是无效的,驱动精灵只能做到oem2.inf和ECTIVA.cat
改名代码
for /f "tokens=1* delims== " %%k in ('type "%inf%"^|find /i ".cat"') do set oemname=%%~nl
if defined oemname for /f "delims=*" %%k in ('dir /s /b /a-d "%SystemRoot%\system32\CatRoot\%infname%.cat" 2^>nul') do set catfile=%%~k
if not defined catfile for /f "delims=*" %%k in ('dir /s /b /a-d "%SystemRoot%\%oemname%.cat" 2^>nul') do set catfile=%%k
if defined catfile (
set infname=%oemname%
xcopy /h /r /y "%catfile%" "drivers\%class%\%name%\*.*">nul 2>>%log%
if errorlevel 0 color 0e&&echo 含WHQL数字签名
attrib -s -h -r "drivers\%class%\%name%\%infname%.*">nul
move /y "drivers\%class%\%name%\%infname%.inf" "drivers\%class%\%name%\%oemname%.inf">nul 2>nul
move /y "drivers\%class%\%name%\%infname%.cat" "drivers\%class%\%name%\%oemname%.cat">nul 2>nul
)
for /f "delims= " %%i in ('devcon hwids %ID%^|sed -n "/Hardware ID's:/{n;p;}"') do echo "%infname%.inf"****"%%~i">>"drivers\HardwareID.log"

