|
本帖最后由 gbzx 于 2021-2-3 19:51 编辑
原来msdri.inf文件必须与devcon.exe匹配,从移植的pe中复制过来
win10pe,下面代码能正常给pe安装驱动_SUB Insdriver
NAME &&fname=%~1
FIND [ $custom=%&fname% | $custom_64=%&fname% ], CALL hwids &&ID1
FIND# $Z=Z%2, EXEC =!%programfiles%\7-zip\7z.exe x %1 -o%temp%\pe-driver\%&fname% # EXEC =!%programfiles%\7-zip\7z.exe x %1 -o%2
FIND# $Z=Z%2, EXEC =!dpinst.exe /S /Path %temp%\pe-driver\%&fname% # EXEC =!dpinst.exe /S /Path %2
WAIT 500
FIND [ $custom=%&fname% | $custom_64=%&fname% ], CALL hwids &&ID2
FIND |%&ID1%<%&ID2%, EXEC -hide -wait dpinst.exe /S /Path %temp%\pe-driver\%&fname%
FIND# $DRIVERS_USB=%&fname%, EXEC =!dpinst.exe /S /Path %temp%\pe-driver\%&fname%
FIND# $Z=Z%2, FILE %temp%\pe-driver
_END
_SUB hwids
EXEC* &&all=!devcon findall *
READ -,0,&&line,%&all%
MSTR &&Q=<1>%&line%
ENVI-ret %1=%&Q%
_EN
_SUB Inswifi
find $3=%&bx64%, envi &&wei=_64! envi &&wei=
FORX !\PESOFT\wifi64.7z,wifi,1,TEAM TEXT 加载无线网卡驱动……#0x0000FF L300 T200 $32:Microsoft YaHei UI|WAIT 500
FORX !\PESOFT\wifi64.7z,wifi,1,CALL Insdriver %wifi%
call sload
_END
_SUB sload
TEAM TEXT 启动无线服务……#0xFFDDDD L300 T250 $32:Microsoft YaHei UI|WAIT 500
EXEC =!net start Wlansvc
WAIT 100
_END
exec* &&wxwk=!devcon status *CC_0280
SED &&W=?,problem,,%&wxwk%
exec* &&usbwk=!find "msdri.inf'" %windir%\inf\setupapi.dev.log
SED &&US=?,0x00,,%&usbwk%
ifex $0=%&US%,!
{
WRIT %temp%\line.txt,$+0,%&usbwk%
exec* &&line=!find "Published" %temp%\line.txt
MSTR -delims:' &&n1,&&n2,&&n3,&&n4=<1*>%line%
EXEC !devcon dp_delete %&n4%
FILE %temp%\line.txt
}
SED &&Y=?,running,,%&wxwk%
ifex $0=%&Y%,! call sload
ifex [ $0<>%&W% | $0<>%&US% ], call Inswifi
我把它移植到我的pe,并补充了devcon.exe msdri.inf。为何不能正常安装驱动?请指教。
|
|