Skip navigation

JSI Tip 4160. How can I determine the installed software from the command-line?


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.1
Active Ports
ActivePerl 521
Adobe Acrobat 4.0
ATI Win2k Display Driver
ATI NT Display Driver
ChangeRes
CyberSafe  Log Analyst
. . . . . .  
Remote Desktop Connection
RegSafe
WebFldrs
UndeleteWorkstation
Windows 2000 Application Compatibility Update
Technical Information and Utilities September 2001
Support Tools Web Package : DCDIAG.EXE
Windows 2000 Administration Tools
DiskeeperWorkstation
ConfigSafe Complete Recovery for NT
Microsoft Windows 2000 Server Resource Kit: Supplement 1
ListApp.BAT contains:
@echo off
regedit /a %TEMP%\filename.reg "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
for /f "Skip=1 Tokens=*" %%i in ('type %TEMP%\Filename.reg') do set line="%%i"&call :parse
goto :EOF
:parse
set work=%line:~2,11%
set work=%work:"=%
If NOT "%work%" EQU "DisplayName" goto :EOF
set 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 syntax is:

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 off
setlocal
set FindApp=N
If \{%1\} EQU \{\} goto :EOF
set param=%1
set param="%param:"=%"
for /f "Tokens=*" %%i in ('call ListApp') do set line="%%i"&call :parse
endlocal&set FindApp=%FindApp%
goto :EOF
:parse
if /i NOT %line% EQU %param% goto :EOF
set FindApp=Y


Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish