JSI Tip 4160. How can I determine the installed software from the command-line?
Jerold Schulman
September 27, 2001
1 Min Read
To list the installed software from a command-line, I have scripted ListApp.BAT. The syntax is ListApp, which returns output similar to:
1 Cool Button Tool 4.1Active PortsActivePerl 521Adobe Acrobat 4.0ATI Win2k Display DriverATI NT Display DriverChangeResCyberSafe Log Analyst. . . . . . Remote Desktop ConnectionRegSafeWebFldrsUndeleteWorkstationWindows 2000 Application Compatibility UpdateTechnical Information and Utilities September 2001Support Tools Web Package : DCDIAG.EXEWindows 2000 Administration ToolsDiskeeperWorkstationConfigSafe Complete Recovery for NTMicrosoft Windows 2000 Server Resource Kit: Supplement 1
ListApp.BAT contains:
@echo offregedit /a %TEMP%filename.reg "HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionUninstall"for /f "Skip=1 Tokens=*" %%i in ('type %TEMP%Filename.reg') do set line="%%i"&call :parsegoto :EOF:parseset work=%line:~2,11%set work=%work:"=%If NOT "%work%" EQU "DisplayName" goto :EOFset work=%line:~16,120%set work=%work:"=%@echo %work%
If you wish to determine if a specific application is installed, you can use FindApp.BAT. The syntaxis:
FindApp "Application String"
If the application is found, the FindApp environment variables is set to Y. If it is not found, the FindApp environment variables is set to N.
FindApp.BAT contains:
@echo offsetlocalset FindApp=NIf {%1} EQU {} goto :EOFset param=%1set param="%param:"=%"for /f "Tokens=*" %%i in ('call ListApp') do set line="%%i"&call :parseendlocal&set FindApp=%FindApp%goto :EOF:parseif /i NOT %line% EQU %param% goto :EOFset FindApp=Y
About the Author
Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.
You May Also Like