I'm trying to make my batch file gather the installed Applications, and I need some help trying to filter and sort the data. Here is what I have so far:
Reg Query HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall /S>c:\temp\installedsoftware.txt
FOR /f "tokens=3 delims= " %%a in ('find "DisplayName REG_SZ" c:\temp\installedsoftware.txt') do Echo %%a>>C:\temp\newsoft.txt
I need to filter out all of the Windows Updates and Security Patches and junk... and then sort the list in Alph. Order.I botched together some code to filter, but it is very inefficient and maybe someone can improve on it for me:
@Echo Off
Echo.>C:\temp\newsoft.txt
Echo.>C:\temp\newsoft2.txt
Echo.>C:\temp\newsoft3.txt
Echo.>C:\temp\newsoft4.txt
Echo.>C:\temp\newsoft5.txt
Echo.>C:\temp\newsoft6.txt
Reg Query HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall /S>c:\temp\installedsoftware.txt
FOR /f "tokens=3 delims= " %%a in ('find "DisplayName REG_SZ" c:\temp\installedsoftware.txt') do Echo %%a>>C:\temp\newsoft.txt
FOR /f "tokens=* skip=3 delims=" %%b in ('find "Microsoft" /v c:\temp\newsoft.txt') do Echo %%b>>C:\temp\newsoft2.txt
FOR /f "tokens=* skip=3 delims=" %%b in ('find "Hotfix" /v c:\temp\newsoft2.txt') do Echo %%b>>C:\temp\newsoft3.txt
FOR /f "tokens=* skip=3 delims=" %%b in ('find "Security Update for" /v c:\temp\newsoft3.txt') do Echo %%b>>C:\temp\newsoft4.txt
FOR /f "tokens=* skip=3 delims=" %%b in ('find "- Software Updates" /v c:\temp\newsoft4.txt') do Echo %%b>>C:\temp\newsoft5.txt
FOR /f "tokens=* skip=3 delims=" %%b in ('find "Update for Windows" /v c:\temp\newsoft5.txt') do Echo %%b>>C:\temp\newsoft6.txt
DEL /Q C:\temp\newsoft.txt
DEL /Q C:\temp\newsoft2.txt
DEL /Q C:\temp\newsoft3.txt
DEL /Q C:\temp\newsoft4.txt
DEL /Q C:\temp\newsoft5.txt
pause
Thanks in advance



Help


Back to top













