Estimated Reading Time: 2 min
Batch Script to Backup and Restore Windows License
This script will backup your Windows license before reinstalling Windows and provide a way to restore it afterward.
Step 1: Backup Windows License
Save the following as backup_license.bat
:
@echo off
echo Backing up Windows License...
mkdir %SystemDrive%\License-Backup
xcopy %SystemRoot%\System32\spp\store\* %SystemDrive%\License-Backup /E /H /C /I
echo License Backup Completed! Files saved in C:\License-Backup
pause
What This Script Does
- Creates a backup folder in
C:\License-Backup
- Copies the Windows license activation files from
C:\Windows\System32\spp\store\
- Preserves all files and hidden attributes
Step 2: Restore Windows License
After reinstalling Windows, restore your license by saving this script as restore_license.bat
:
@echo off
echo Restoring Windows License...
xcopy %SystemDrive%\License-Backup\* %SystemRoot%\System32\spp\store /E /H /C /I
echo Windows License Restored!
pause
What This Script Does
- Copies the license backup back to its original location.
- Ensures all files are restored correctly.

Step 3: Reactivate Windows
After restoring the backup, run this command manually in Command Prompt (Admin):
slmgr /ato
- This forces Windows to re-check the restored activation.
How to Use These Scripts
- Before reinstalling Windows:
- Run
backup_license.bat
- Copy the
C:\License-Backup
folder to a safe location (e.g., USB or external drive).
- Run
- After reinstalling Windows:
- Copy
License-Backup
back toC:\
- Run
restore_license.bat
- Run
slmgr /ato
to activate Windows.
- Copy
Important Notes
✅ Works for OEM and Retail Windows licenses
✅ Does NOT work for Volume Licensing (Enterprise)
✅ Ensure you run these scripts as Administrator