Skip to content

Instantly share code, notes, and snippets.

@muink
Last active March 22, 2020 08:03
Show Gist options
  • Save muink/67d885b22fd989d0742cc564781b8fee to your computer and use it in GitHub Desktop.
Save muink/67d885b22fd989d0742cc564781b8fee to your computer and use it in GitHub Desktop.
Clean up and export "Steam App [0-9]+" keys from Registry uninstall info
:: SteamAppKeysCleanAndExport
:: Clean up and export "Steam App [0-9]+" keys from Registry uninstall info
:: Author: muink
@echo off
%~1 mshta vbscript:createobject("shell.application").shellexecute("%~f0","::","","runas",1)(window.close)&exit
cd /d %~dp0
set "KEYS=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
set "DIR=SteamAppKeys"
md "%DIR%" 2>nul
setlocal enabledelayedexpansion
for /f "delims=" %%i in ('reg query "%KEYS%" /f "Steam App *" 2^>nul ^| findstr /r /c:"Steam App [0-9][0-9]*$"') do (
for /f "tokens=2* delims= " %%n in ('reg query "%%~i" /v "DisplayName" /t REG_SZ ^| find "REG_SZ" 2^>nul') do (
set "name=%%~o"
set "name=!name:\=!"
set "name=!name:/=!"
set "name=!name::=!"
set "name=!name:^*=!"
set "name=!name:?=!"
set "name=!name:"=!"
set "name=!name:<=!"
set "name=!name:>=!"
set "name=!name:|=!"
reg export "%%~i" "%DIR%\!name!.reg" /y && reg delete "%%~i" /f && set /a conut+=1
)
)
echo.Total %conut% keys...
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment