I'm writing a program that requires the ability to list all applications installed, and it will do that by listing all the uninstallers for it in a specific directory. This code isn't working, and the directory is created and there are files in the directory
if (startarg.Contains("-il") == true)
{
//Lists all installed programs here
DirectoryInfo uninstalldir = new DirectoryInfo("Uninstallers");
FileInfo[] UninstallerFiles = uninstalldir.GetFiles();
Console.WriteLine("Listing all applications installed with Simtho");
foreach (FileInfo files in UninstallerFiles)
{
Console.WriteLine(files.Name.ToString());
}
I know it needs the full path, but I won't know the full path so it needs to be a variable, how can I make something like this work?
DirectoryInfo uninstalldir = new DirectoryInfo(Directory.GetCurrentDirectory + "\" + "Uninstallers");