@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