[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 8863
  • Last Modified:

Batch file for installed applications

I hae two similar questions.


1 .Is it possible to run a batch file to simply place into a text document a list of all the applications installed on your computer

2. Is it possible to run a batch file to check that an particular application has been installed ?

Many thanks

GISVPN
0
gisvpn
Asked:
gisvpn
2 Solutions
 
rockiroadsCommented:
To get a list of applications installed on your computer, you can do it by registry or directory

if you do by registry, you will proabably have to write some code (I can do it in VB but not in DOS)
with a directory, you can assume everything has been installed in C:\Program Files (this is the usual location, although it can be overridden)

then list all directories under that, but it gives you a directory name, not name of application


registry:
if you open up RegEdit then go to

HKEY_LOCAL_MACHINE
SOFTWARE
Microsoft
Windows
CurrentVersion
Uninstall

Open that branch and you will see a series of subbranchs, just click on each one and it gives you details of the applicaton installed

if you highlite Uninstall, then select menu Registry, Export Registry file, you can export all this info into a file (called .reg, just rename to .txt)

0
 
rockiroadsCommented:
If you dont know registry, I dont recommend you change anything, can cause major disasters if you play around with it
0
 
rockiroadsCommented:
ok, how to export registry entries from command line

regedit /e <name of file.txt> "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
_nn_Commented:
Hi,

Based on rockiroads's idea, you could use VBS. There is an example at http://www.winnetmag.com/Files/07/39314/Listing_02.txt 
(link found from http://www.winnetmag.com/WindowsScripting/Article/ArticleID/39314/39314.html )

I made some simple tests and it proved working. For exporting a listing in a text file, I just used

  > listapps.txt cscript ListApps.vbs

a oneliner you can easily plug into a batch file, which would solve your question 1. For Q 2., it's possibly just a matter of piping that output into a find command, something like

  cscript ListApps.vbs | find /I "Microsoft Windows 2000 Server Resource Kit"

which would check whether the resource kit is installed or not.
0
 
KavarCommented:
GISVPN:

Yes on both accounts, but I think what you want should be accomplished using another means...

The problem as to whether or not a piece of software is installed has come up MANY times.  What does installed mean?  Does it mean the app works 100%?  If that is the definition you are looking for, one simple reg Query will not suffice.  If all you are looking for is if the application has at one time been installed AND it has not been officially uninstalled, then using

regedit /e c:\reg.txt "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"|findstr "{Software Name | Class ID}"
%b%=notinstalled
for /F %%a in (c:\reg.txt) do %b%=installed

2 special notes, do not use find on win2k and xp
now you have a variable in a batch that tells you whether or not your software is installed

The problem is that you have no Idea if the program is REALLY installed, for one, the uninstall key may not be populated but the application is still there  (happens a lot when a tech doesn't have install software and they are pressured into fixing an issue)  For 2, the application may be installed but "Damaged" to the point that it doesn't work.

What we have done to solve / get around this issue:
We use TSCensus and SMS2003 both of these provide very detailed informtation on software inventory.
0
 
gisvpnAuthor Commented:
hello all and thanks for your comments :)


rockiroads

thanks this works well......however a little extra thing is that i would like to be able to filter out alot of the stuff it returns to the text file. I wish to only see what Hotfixes have been installed on the computer. They all contain the word HOTFIX somewhere in the display name... is it possible to only return the keys with the word HOTFIX somewhere in the display name ?


_nn_

thanks for the vbs however i cannot get it to work :(

Kavar

Sounds good, could i ask why cannot i not use find on Win XP and 2000 ? :) do you know how i can search for all the keys at  "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" which has the word HOTFIX somewhere in the display name ?
0
 
KavarCommented:
yeah#1 win2k and xp regedit exports in unicode find only works on ascii

yeah #2
type c:\reg.txt|findstr -i "hotfix" > C:\regResults.txt

-- I still would prefer to do these manipulations using more interactive methods, I can help you if you want a script for determining hotfixes...

0
 
rockiroadsCommented:
Im not sure how to do it within regedit, you would need to know keys

there might be a filter within DOS to search for specific strings. I think its FIND

FIND /I "string to find" "filename"

where /I is ignore case
e.g.
find /i "hotfix" "myfile.txt"


Unix has grep which is a great utility but for a windows version, you can get a evalution version of wingrep http://www.wingrep.com
that might help u


0
 
KavarCommented:
there is both find and findstr
in this case as I said earlier, he will want to use findstr
0
 
rockiroadsCommented:
sorry kavar, had the window open, checked on dos to see what is the search equivalent then posted, then I saw yours!

0
 
KavarCommented:
no worries :)
0
 
rockiroadsCommented:
Ive got win2k, couldnt find findstr,

you got unixy background?

type .. | ...

is more a unixy type stuff
0
 
KavarCommented:
maybe its a resource kit tool (don't think so)

Yeah, I love unix, just waiting for the world to come around so I can get a high paying job as an IT manager over a unix shop

0
 
rockiroadsCommented:
ha, Im a unix background as well, always preferred it and always will, but Ive been with Windows last few years, do miss Unix

cant do powerful shell scripting in Windows/Dos like you could with Unix

so sad, I even came across VI for Windows - now VI on Unix was a great editor!
0
 
KavarCommented:
the power of VI and sed ....

takes so much on a bloat-dows system to get anywhere near that simple power...
0
 
rockiroadsCommented:
not forgetting awk...
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now