中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-15 01:57
47,813 topics / 349,902 posts / today 4 new / 48,257 members
其它操作系统综合讨论区 » Backing up drivers with pure script借助DevCon, compatible with Driver Genius (2008-01-17)
Printable Version  82,479 / 72
Floor1 fastslz Posted 2007-11-06 13:30
铂金会员 Posts 2,315 Credits 5,493 From 上海
At the request of members the post about safely deleting USB drives using pure scripts, I accidentally discovered the DevCon command and had an idea to write a script using this command to back up device drivers. This script can back up all device drivers, including hidden devices in Device Manager, and the backup items exceed those of the familiar Driver Genius.


Update Instructions:
  I can't say this script is more perfect than Driver Genius, but it does make up for the deficiencies of Driver Genius!
1、Supports backing up complete WHQL digital signatures (the Driver Genius 2005 Professional Edition I have doesn't support this), and I don't know about other updated versions because I don't want to worry about activating keys for higher versions :-)
2、Compatible with items that Driver Genius has already backed up, that is, running the script once will restore all items that Driver Genius has ever backed up, and the path is arbitrary, as long as it is searched out on the hard drive or USB drive and updated.
3、Supports the way of restoring driver by clicking the dialog box to select a single device with the mouse.
4、Supports the silent external installation and update of drivers, which is convenient for system integration and Ghost users to call.
5、Corrects possible copy errors, updates the screen display method when backing up, and prints out the device name containing the WHQL digital signature
6、Updated on 2008-01-17 to solve the problem of repeated backup of the same device and update the code stability





Attachments
备份驱动.rar (91.35 KiB)
Floor2 hello547rf44 Posted 2007-11-06 20:24
初级用户 Posts 63 Credits 172
COOL, just found out about this great thing from Master vkill and immediately used it. The test results are as follows:

Backing up driver ---> "Intel(R) 82845 Processor to I/O Controller - 1A30"
Backing up driver ---> "Intel(R) 82845 Processor to AGP Controller - 1A31"
Backing up driver ---> "Intel(R) 82801BA LPC Interface Controller - 2440"
Backing up driver ---> "Intel(R) 82801BA/BAM USB Universal Host Controller - 2442"
Backing up driver ---> "Intel(R) 82801BA/BAM SMBus Controller - 2443"
Backing up driver ---> "Intel(R) 82801BA/BAM USB Universal Host Controller - 2444"
Backing up driver ---> "Intel(r) 82801BA/BAM AC'97 Audio Controller"
Backing up driver ---> "Intel(R) 82801BA Ultra ATA Storage Controller - 244B"
Backing up driver ---> "Intel(R) 82801 PCI Bridge - 244E"
Backing up driver ---> "USB Root Hub"
Backing up driver ---> "USB Root Hub"
Backing up driver ---> "Unknown Device"
Backing up driver ---> "USB USB\VID_8086&PID_1122\5&16DC22A8&0&2
: Generic USB Hub"
Backing up driver ---> "WDC WD400BB-00JHC0"

17 device drivers have been backed up

An error occurred during the copying process
Please check the log file "Drivers\1.log"

Press any key to continue...

It seems there is a bit of duplicate backup.
Floor3 hello547rf44 Posted 2007-11-06 20:27
初级用户 Posts 63 Credits 172
Looking forward to the work of restoring the driver!

Attachments
1.gif (5.23 KiB)
Floor4 fastslz Posted 2007-11-07 13:26
铂金会员 Posts 2,315 Credits 5,493 From 上海
Restoring drivers is not easy to handle. I've thought of several solutions, but now my mind is full of symbols, and I'm completely at a loss. The devcon install parameter isn't suitable for the known hardware, and devcon update must first obtain the hardware ID. The hardware ID has a certain pattern but is not easy to screen, and we also need to screen out those that don't need to be updated.
Floor5 fastslz Posted 2007-11-07 13:52
铂金会员 Posts 2,315 Credits 5,493 From 上海
This floor I'll just post some Devcon related parameters and other applications


Common types: PCI PCIIDE USB USBSTOR IDE PCIIDE DISPLAY
Devcon hwids * Get all hardware IDs
Devcon hwids Common types\* Get common type hardware IDs
Devcon find Common types\* Find common type hardware information
Devcon find gendisk Only find hard disk including mobile hard disk information
Devcon find gencdrom Only find CD-ROM information
Devcon update xxx.inf Hardware ID Update driver


Query: All PCI, AGP, PCI-X, PCIe hardware IDs and names in the world This site continuously updates information (if you are an OEM device then check it out)



[ Last edited by fastslz on 2007-11-7 at 06:09 PM ]
Floor6 vkill Posted 2007-11-07 21:49
金牌会员 Posts 1,744 Credits 4,103 From 甘肃.临泽
After running devcon hwids *, the following section is observed:



Backing up the driver ---> "RADEON 9550 "
Press any key to continue. . .

Now, looking at the just-backed-up folder, there is an inf file.



I think it should be no problem to update all four of the following:
Hardware ID's:
PCI\VEN_1002&DEV_4153&SUBSYS_41531FD3&REV_00
PCI\VEN_1002&DEV_4153&SUBSYS_41531FD3
PCI\VEN_1002&DEV_4153&CC_030000
PCI\VEN_1002&DEV_4153&CC_0300
Whoever tests it is fine.

[ Last edited by vkill on 2007-11-7 at 09:58 PM ]
Floor7 vkill Posted 2007-11-07 22:09
金牌会员 Posts 1,744 Credits 4,103 From 甘肃.临泽
C:\>cd C:\Downloads\Drivers\USB\USB Root Hub

C:\Downloads\Drivers\USB\USB Root Hub>devcon update "C:\Downloads\Drivers\USB\US
B Root Hub\usbport.inf" "USB\ROOT_HUB&VID10DE&PID00E7&REV00A1"
Updating drivers for USB\ROOT_HUB&VID10DE&PID00E7&REV00A1 from C:\Downloads\Driv
ers\USB\USB Root Hub\usbport.inf.
Drivers updated successfully.

C:\Downloads\Drivers\USB\USB Root Hub>devcon update "C:\Downloads\Drivers\USB\US
B Root Hub\usbport.inf" "USB\ROOT_HUB&VID10DE&PID00E7"
Updating drivers for USB\ROOT_HUB&VID10DE&PID00E7 from C:\Downloads\Drivers\USB\
USB Root Hub\usbport.inf.
Drivers updated successfully.

C:\Downloads\Drivers\USB\USB Root Hub>devcon update "C:\Downloads\Drivers\USB\US
B Root Hub\usbport.inf" "USB\ROOT_HUB"
Updating drivers for USB\ROOT_HUB from C:\Downloads\Drivers\USB\USB Root Hub\usb
port.inf.
Drivers updated successfully.
Like this update of the USB Root Hub has no problems, everything is normal
Floor8 fastslz Posted 2007-11-07 23:00
铂金会员 Posts 2,315 Credits 5,493 From 上海
```
PCI\VEN_1002&DEV_4153&SUBSYS_41531FD3&REV_00
PCI\VEN_1002&DEV_4153&SUBSYS_41531FD3
PCI\VEN_1002&DEV_4153&CC_030000
PCI\VEN_1002&DEV_4153&CC_0300
Compatible ID's:
PCI\VEN_1002&DEV_4153&REV_00
PCI\VEN_1002&DEV_4153
PCI\VEN_1002&CC_030000
PCI\VEN_1002&CC_0300
PCI\VEN_1002
PCI\CC_030000
PCI\CC_0300
```
The above are all hardware IDs, some are fewer and some are more. devcon update oem4.inf can successfully update all 10 above. The most common one is PCI\VEN_1002, that is, filter out the first few digits before the first occurrence of &. This filtering is the most common. But sometimes it is not common on USB devices such as
"@USB\ROOT_HUB\4&1D255E7A&0"
"@USB\ROOT_HUB\4&84E02D0&0"
"@USB\ROOT_HUB\4&A6BADD5&0"


The hardware IDs have been generated during backup and saved in HardwareID.log
Floor9 fastslz Posted 2007-11-08 13:04
铂金会员 Posts 2,315 Credits 5,493 From 上海
The restore driver has been written. It's packed and downloadable on the first floor. sed.exe is needed. If you have any questions, post a reply.

Also, friends who have SATA, SATAII, SCSI, IEEE1394 devices, please let us know whether these devices are in the common types. Thanks



































[ Last edited by fastslz on 2007-11-8 at 05:10 PM ]
Floor10 hello547rf44 Posted 2007-11-08 13:56
初级用户 Posts 63 Credits 172
NVIDIA GeForce4 MX 440 (Microsoft Corporation)
D-Link DFE-530TX PCI Fast Ethernet Adapter (rev.C) #3
D-Link DFE-530TX PCI Fast Ethernet Adapter (rev.C) #2
Intel(R) 82845 Processor to I/O Controller - 1A30
Intel(R) 82845 Processor to AGP Controller - 1A31
Intel(R) 82801BA LPC Interface Controller - 2440
Intel(R) 82801BA/BAM USB Universal Host Controller - 2442
Intel(R) 82801BA/BAM SMBus Controller - 2443
Intel(R) 82801BA/BAM USB Universal Host Controller - 2444
Intel(r) 82801BA/BAM AC'97 Audio Controller
Intel(R) 82801BA Ultra ATA Storage Controller - 244B
Intel(R) 82801 PCI Bridge - 244E
USB Root Hub
USB Root Hub
Unknown Device
USB USB\VID_8086&PID_1122\5&16DC22A8&0&2 : Generi
SB Hub
File not found - input.inf
WDC WD400BB-00JHC0

Please select the device name to update, input continuously more than 5 bytes vaguely ↘








Don't know how to use
Floor11 fastslz Posted 2007-11-08 14:03
铂金会员 Posts 2,315 Credits 5,493 From 上海
I just found out too. This situation will occur with full backups. Oh, need to fix....
Fuzzy input means NVIDIA GeForce4 MX 440 (Microsoft Corporation), just input NVIDIA

[ Last edited by fastslz on 2007-11-8 at 02:04 PM ]
Floor12 hello547rf44 Posted 2007-11-08 14:25
初级用户 Posts 63 Credits 172
Not bad, not bad. It is suggested to add an auto parameter additionally. It can restore all drivers in the Drives directory in silent mode. (Even if there are individual errors, no prompt will be given) If this can also be realized, it is suggested to add a compression package function to "Backup Drivers.bat" and "Restore Drivers". Package all drivers into a file like mydrives.zip. For restoration, just unzip it first. Wow, in this way, it won't be long before those GHOST system - like installation discs for installing systems will have new updates. Haha. Why isn't such a good post highlighted?
Floor13 sh2288 Posted 2007-11-08 15:39
新手上路 Posts 2 Credits 4
Expert! I only use this tool to switch network cards! One network card is boardcom, and the other is 8139. Because one is internal and the other is external, so it's troublesome to do it manually!!

devcon disable *DEV_1677* >nul
devcon enable *DEV_8139* >nul
Floor14 fastslz Posted 2007-11-08 17:56
铂金会员 Posts 2,315 Credits 5,493 From 上海
Originally posted by hello547rf44 at 2007-11-8 14:25:
Not bad, not bad. Suggest adding an additional auto parameter. It can restore all drivers in the Drives directory in silent mode. (Even if there are individual errors, no prompts are given) If this can also be achieved, then suggest "Backup drivers...

Restoring also requires driver optimization, this is just a temporary restore script. Compression is the simplest, directly call
start winrar.exe u -ep1 -m5 -r .\MyDrivers.rar .\*
As for ghost system, I'm not keen on it, but if the drivers and hardware IDs are collected enough, it can be completely done. I prefer to install drivers with external scripts when installing the system

Originally posted by sh2288 at 2007-11-8 15:39:
Expert!! I only use this tool to switch network cards!!
One network card is boardcom, and the other is 8139. Because one is internal and the other is external, so it's troublesome to do manually!!

devcon disable *DEV_1677* >nul
devcon enable *DEV_8139* >nul

Indeed, it's a good method. Situations like yours are very common, hehe, now there are new tricks...
Floor15 fastslz Posted 2007-11-13 14:07
铂金会员 Posts 2,315 Credits 5,493 From 上海
```code
@echo OFF
title Restore Update (Driver Genius) Backup Items
::::::Related Discussion: http://www.cn-dos.net
::::::Online Forum:  http://groups.google.com/group/fastslz
::::::Personal Space: http://space.cech.com.cn/fastslz
if not %OS%==Windows_NT (cls&echo.&color 4E&echo This program must run on Windows NT or above 2000 operating system&ping/n 5 127.1>nul&EXIT)
devcon.exe>nul 2>nul
if %errorlevel%==9009 (cls&echo.&color 0E&echo This script requires the support of Microsoft DevCon.exe command-line utility&ping/n 5 127.1>nul&EXIT)
set log="Drivers\%~n0.log"
set Tempfile="%Temp:"=%.\fast.slz"
set count=0
del "Drivers\*.log" 2>nul
del %Tempfile% 2>nul
cls&color 0b
echo.
echo Searching for (Driver Genius) backup item information throughout the disk, this may take a long time, please wait...
setlocal enabledelayedexpansion
for /f "delims=\" %%i in ('fsutil fsinfo drives^|find /v "a"') do (
set var=%%i
set drive=!var:~-2!
fsutil fsinfo drivetype !drive!\|find /v "-ROM">nul &dir /s /b /a-d !drive!\Driver.nfo>>%Tempfile% 2>nul
)
for /f "delims=*" %%i in ('type %Tempfile%^|find /i /v "RECYCLE"') do type "%%i"|find /i "InfFile">nul 2>nul
if %errorlevel%==1 cls&echo.&color 0e&echo No (Driver Genius) backup item information found on all local disks and removable disks&echo If the driver file is compressed, please extract the file to any location, then run this script&ping/n 10 127.1>nul&exit/b

:::::goto Driver_start
Wprompt "Prompt Information" "Press OK to start restoring the items backed up by Driver Genius, please contact me for the single recovery mode script " OkCancel 2 ?
if %errorlevel%==2 color 0e&echo User canceled the operation . . .&ping/n 3 127.1>nul&exit/b

:Driver_start
cls
for /f "delims=*" %%i in ('type %Tempfile%^|find /i /v "RECYCLE"') do (
for /f "tokens=1* delims==" %%a in ('type "%%~i"^|find /i "DriverName"') do (
for /f "tokens=1* delims==" %%e in ('type "%%~i"^|find /i "InfFile"') do (
for /f "tokens=1* delims==&" %%k in ('type "%%~i"^|find /i "HardwareID"') do (call :startdriver "%%b" "%%~dpi%%f" "%%l")
)
)
)
del %Tempfile% 2>nul
echo.
echo A total of %count% device drivers were updated
echo.
echo Press any key to exit. . .&pause>nul

:startdriver
set "ID=%~3"
set "typename=%~1"
if not defined typename goto:eof
set/p=Updating--^> "%typename:~0,47%"<nul
if not exist "%~2" echo No corresponding item, execute the next item . . .&ping/n 2 127.1>nul&goto:eof
rem If the update cannot be successful, try adding symbols to the next for statement delims=&
for /f "delims=" %%m in ('echo."%ID%"') do devcon updateNI "%~2" "%%~m">nul
if %errorlevel%==0 color 0e&echo ^<--Device driver has been updated&ping/n 1 127.1>nul&color 0b
if %errorlevel%==1 color 0e&echo ^<--Update prompt to restart&ping/n 1 127.1>nul&color 0b
if %errorlevel%==2 color 0e&echo ^<--Update failed!&echo The reason is that the hardware ID is not correctly judged, or the driver source is incorrect.&ping/n 1 127.1>nul
if %errorlevel%==3 color 0e&echo DevCon syntax error.&ping/n 1 127.1>nul
set /a "count=%count%+1"
del %Tempfile% 2>nul
endlocal&(set count=%count%)
goto:eof

[ Last edited by fastslz on 2008-1-17 at 10:26 PM ]
```
1 2 3 45  Next
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023