This script retrieves a list of installed programs on a Windows computer, including the display name and version number, and saves the list to a file on the user’s desktop.
The script uses the reg query
command to search through the Windows registry for entries related to installed programs. Specifically, it searches the Uninstall
keys in the HKLM
(HKEY_LOCAL_MACHINE) and HKCU
(HKEY_CURRENT_USER) hives, as well as the 32-bit and 64-bit versions of these hives.
The script then filters and sorts the program names, removing any blank lines or lines that start with „@“ or „C:\\“. This is done using the findstr
and sort
commands.
Finally, the script removes any duplicate entries in the program list and saves the result to a file on the user’s desktop.
Note that this script does not include Windows Store apps in the program list.
@echo off
setlocal enabledelayedexpansion
:: Set the output file path to the current user's desktop
set OUTPUT_FILE="%USERPROFILE%\Desktop\windows-installed-programs.txt"
:: Get the list of installed programs and save it to a temporary file
reg query HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall /s | findstr /R "DisplayName" > %TEMP%\temp_program_list.txt
reg query HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall /s | findstr /R "DisplayName" >> %TEMP%\temp_program_list.txt
reg query HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall /s | findstr /R "DisplayName" >> %TEMP%\temp_program_list.txt
reg query HKCU\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall /s | findstr /R "DisplayName" >> %TEMP%\temp_program_list.txt
:: Extract, filter, and alphabetically sort the program names
(for /F "tokens=2* delims== " %%A in (%TEMP%\temp_program_list.txt) do echo %%B) | findstr /R /V "^$ ^@ ^C:\\\\" | sort > %TEMP%\temp_program_list_sorted.txt
:: Remove duplicates and save the result to the output file
(for /F "delims=" %%A in (%TEMP%\temp_program_list_sorted.txt) do if not defined UNIQUE[%%A] (echo %%A & set UNIQUE[%%A]=1)) > %OUTPUT_FILE%
:: Delete the temporary files
del %TEMP%\temp_program_list.txt
del %TEMP%\temp_program_list_sorted.txt
:: Close the command prompt
exit
Save the script with the .bat-extension and double click to run it.