I figured out a cheap trick on how to do this. When the application starts, read the registry again to get the application launch path (the one you intended). For example: Appl1 has a startup path of "C: \ Users \ Name \ Desktop \ App1.exe".
Once you read the registry for this path, set it as the current directory. Something like that:
RegistryKey RegKey = Registry.LocalMachine; RegKey = RegKey.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", false); string Path = RegKey.GetValue("App1.exe").ToString(); Path = Path.Replace(@"\App1.exe"", ""); // Now it a valid directory. Directory.SetCurrentDirectory(Path);
It worked for me, but if anyone has a better method, I would love to hear them.
source share