|
可以自动识别安装驱动的inf文件延伸:在重装系统前可以先备份驱动,重装系统后再安装驱动,这样快速简洁(当然也可以辅以其他小程序来实现,比如DISM++的备份和还原功能)。
@echo off&mode con: cols=50 lines=13&title 驱动备份、还原工具 &color 17 &setlocal enabledelayedexpansion
if exist "%SystemRoot%\SysWOW64" path %path%;%windir%\SysNative;%SystemRoot%\SysWOW64;%~dp0&bcdedit >nul
if '%errorlevel%' NEQ '0' (goto UACPrompt) else (goto UACAdmin)
:UACPrompt
%1 start "" mshta vbscript:createobject("shell.application").shellexecute("""%~0""","::",,"runas",1)(window.close)&exit
exit /B
:UACAdmin
cls
echo.
echo 驱动备份、还原工具
echo --------------------------------------------------
echo.
echo. [1] 备份驱动
echo.
echo. [2] 恢复驱动
echo.
echo --------------------------------------------------
choice /c:1234 /n /m "输入你的选择 :"
echo --------------------------------------------------
if errorlevel 2 goto :Recurse
if errorlevel 1 goto :Backup
:B
:-B
:Backup
echo 正在备份驱动。。。
mkdir .\DriversBackup 2>nul
dism /online /export-driver /destination:.\DriversBackup >nul 2>nul
echo 驱动备份完成 & pause >nul 2>nul & goto UACAdmin
:R
:-R
:Recurse
echo 正在恢复驱动。。。
for /f "delims=" %%a in ('dir /b /s /a-d ".\DriversBackup\*.inf"') do infdefaultinstall "%%a"
echo 驱动恢复完成 & pause >nul 2>nul & goto UACAdmin
|
|