![]() |
Desktop Development »
Files and Folders »
Utilities
Beginner
License: The Code Project Open License (CPOL)
Software's List Installed on Windows MachineBy surendrakishorThis program gets the list of softwares installed on Windows running machine |
C# (C# 2.0, C# 3.0), VB (VB 8.0), Windows (Win2K, WinXP, Win2003, Vista), .NET (.NET 2.0, .NET 3.0, .NET 3.5), Visual Studio (VS2005, VS2008), Architect, Dev
|
|
Advanced Search Add to IE Search |
|
|
|
||||||||||||||||
Many of us don't know what softwares are installed and strive to check them programatically. Here's a simple way to get that list. This is very useful when you want to create an installer for your projects, which helps you in checking the right version of minimal software requirements for your projects on clients' machine.
There's no complicated code in this. If you have basic knowledge of Windows Registry, that's enough. But be sure you make a backup of your registry before doing anything with it as that is a good and safe way of programming.
I have taken a simple Console Application in C#, created an object for registry accessing the right path, i.e. SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall.
This registry path has all the list of softwares installed on your machine. Following is the code to achieve it in C#.
class Program
{
static void Main(string[] args)
{
// Do back up of ur registry before running it.
//Registry path which has information of all the softwares installed on machine
string uninstallKey = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall";
using (RegistryKey rk = Registry.LocalMachine.OpenSubKey(uninstallKey))
{
foreach (string skName in rk.GetSubKeyNames())
{
using (RegistryKey sk = rk.OpenSubKey(skName))
{
// we have many attributes other than these which are useful.
Console.WriteLine(sk.GetValue("DisplayName") +
" " + sk.GetValue("DisplayVersion"));
}
}
}
Console.ReadLine(); // To make the o/p readable.
}
}
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports Microsoft.Win32
Namespace SEList
Class Program
Private Shared Sub Main(args As String())
' Do back up of ur registry before running it.
'Registry path which has information of all the softwares installed on machine
Dim uninstallKey As String = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
Using rk As RegistryKey = Registry.LocalMachine.OpenSubKey(uninstallKey)
For Each skName As String In rk.GetSubKeyNames()
Using sk As RegistryKey = rk.OpenSubKey(skName)
' we have many attributes other than these which are useful.
Console.WriteLine(sk.GetValue("DisplayName") + " " + sk.GetValue("DisplayVersion"))
End Using
Next
End Using
Console.ReadLine() ' To make the o/p readable.
End Sub
End Class
End Namespace

This code snippet is handy for developers working on creating installers for projects, which gives them flexibility to check the correct version of software installed on client machine to avoid confusion later. It's a good way of creating the installers. This is useful for all kinds of applications developed in Microsoft .NET environment.
This is my first article on CodeProject. Hope to post more useful code snippets in future. Leave me your suggestions and comments as these are the things which boost us and help us in giving more relevant and error free code snippets.
| You must Sign In to use this message board. | |||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||
General
News
Question
Answer
Joke
Rant
Admin
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 30 Sep 2008 Editor: Deeksha Shenoy |
Copyright 2008 by surendrakishor Everything else Copyright © CodeProject, 1999-2009 Web22 | Advertise on the Code Project |