Console Problem C#

Don
Joined
5 Oct 2005
Posts
11,239
Location
Liverpool
Ok here it is...
class Class1
{
[STAThread]
static void Main(string[] args)
{
// read and display the user's Internet Explorer start page

// open the registry key
RegistryKey rk = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall");

if (rk == null)
{
Console.WriteLine("Registry key does not exist.");
}
else
{
try
{
TextWriter tw = new StreamWriter("t:\\ComputerSoftware\\"+Environment.MachineName+".txt");
tw.WriteLine(DateTime.Now);
tw.WriteLine(Environment.UserName);
tw.WriteLine(Environment.MachineName);


foreach (string valuename in rk.GetValueNames())
{
rk.GetValue(valuename).ToString();
tw.WriteLine("Start page = {0}", valuename);
}

tw.Close();
}
finally
{

// cleanup
rk.Close();
}
}
}
}
}

but the its not working correct... its supposed to write in a text file all the displaynames in the unnstall registry directory...

Ideas?

Stelly
 
it'll be the extra space in the registry key that's breaking it ;)

Paul

edit iirc you are trying to get a list of all installed software in the machine? that's not the right place to look in the HKLM hive and I have a whole bunch of software installed on my development machine that doesn't make itself know in the registry
 
Last edited:
Back
Top Bottom