Ryan

Ryan

  • NA
  • 5
  • 0

Finding the path of the current program

Jul 20 2005 11:40 PM
Is there an easy way to do that? I'm relatively new to C# and I'm writing a program that gives the user the option (via a checkbox) to start when windows boots up. To do that, I was going to add a registry key using the following:

RegistryKey key = Registry.CurrentUser.OpenSubKey( @"Software/Microsoft/Windows/CurrentVersion/Run", true);
key.setValue("program name", "PATH GOES HERE");

But I don't know how to find out the path where the program is. Is there a way to find it without resorting to a search for the program name (which the user could have just changed anyway) like in this example http://www.codeproject.com/csharp/WinWhich.asp ?
Thanks in advance

Answers (6)