Why is this
ProcessStartInfo myProcess = new ProcessStartInfo(path);
myProcess.UserName = username;
myProcess.Password = MakeSecureString(password);
myProcess.UseShellExecute = false;
Process.Start(myProcess);
working, but
ProcessStartInfo myProcess = new ProcessStartInfo();
myProcess.FileName = Path.GetFileName(path);
myProcess.WorkingDirectory = Path.GetDirectoryName(path);
myProcess.UserName = username;
myProcess.Password = MakeSecureString(password);
myProcess.UseShellExecute = false;
Process.Start(myProcess);
is not.
I wanted to use the second one because of this question: https://stackoverflow.com/a/2621943/1306186
I am constantly getting a file not found exception... Any ideas?
Edit:
Path is for example @"C:\Users\User\Desktop\ConsoleApplication2.exe"