What it does
After a fresh Windows install the hardest part is often finding drivers again, especially for Wi-Fi or network adapters, which you need before you can download anything. Windows can export every third-party driver it has installed, but only from the command line.
In backup mode this script copies all installed third-party drivers into a dated folder (an external drive or USB stick is ideal). In restore mode it installs every driver from a backup folder. It uses Windows' own DISM and PnPUtil tools and needs administrator rights.
How to use Back Up and Restore Drivers
- For a backup, choose a folder on another drive or a USB stick, download the script and run it as administrator.
- After reinstalling Windows, make the script again in restore mode, type the dated folder it created (like D:\Driver Backup\MYPC_2026-11-11) and run it as administrator.
- Restart when it's done.
Making the .bat file yourself
The download button already gives you a ready-to-run .bat file. If you'd rather copy the code, or the download gets blocked, you can make the file yourself in Notepad:
- Click Copy code, open Notepad and paste.
- Choose File › Save as. Set Save as type to All files (*.*). This step matters: if it stays on "Text documents", Notepad quietly adds
.txt. - Type a name ending in
.bat, likemy-script.bat, and save. You can also type the name in quotes,"my-script.bat", which forces that exact name even on "Text documents". - Check the file's icon: a .bat file shows a gear-window icon, not a notepad page. Double-click it to run.
My file ended up as script.bat.txt and opens in Notepad. How do I fix it?
Windows hides file extensions by default, so the file looks like script.bat but is really script.bat.txt. Turn extensions on: in File Explorer, choose View › Show › File name extensions (Windows 11) or tick File name extensions on the View tab (Windows 10). Then rename the file, delete the .txt at the end, and click Yes when Windows asks if you're sure you want to change the extension.
How it works
| Command | What it does |
|---|---|
dism /online /export-driver /destination:"…" | Copies every third-party driver installed on this Windows into the folder, one subfolder each. |
pnputil /add-driver "…\*.inf" /subdirs /install | Adds every driver found in the folder and its subfolders, and installs them for matching hardware. |
%COMPUTERNAME%_%STAMP% | Names the backup after the PC and the date, so backups from different PCs don't mix. |
net session | Checks for administrator rights, which both tools need. |
Back Up and Restore Drivers FAQ
Does it back up Windows' own drivers?
No, only third-party ones (graphics, Wi-Fi, chipset, audio, printers and so on). Windows' built-in drivers come back with Windows anyway.
Can I restore on a different PC?
Drivers only install for hardware that matches, so it's safe, but it mostly helps on the same PC or an identical one.
Should I still get new drivers later?
Yes. The backup gets you working right away; graphics drivers in particular are worth updating from NVIDIA, AMD or Intel afterwards.
How do I run a .bat file?
Double-click it. To see or edit the code, right-click it and choose Edit (or open it in Notepad). Scripts that need administrator rights say so; for those, right-click › Run as administrator.
Is this script uploaded or tracked?
No. The code is built in your browser from the settings above and downloaded straight to your PC.
Related
- Create a Restore Point: Make a System Restore point before installing drivers or tweaking Windows.
- System Info Report: Save PC specs, Windows version, disks and network details to a text file.
- Installed Programs List: Save a list of every installed program, with versions, to a spreadsheet.
- All batch scripts