Running another application from C# code in another folder with spaces

  • Thread starter Thread starter Mawero
  • Start date Start date
M

Mawero

Guest
Hi all.

I've got a .exe file with some dlls etc in a folder called "My Folder". When i double click that exe the program just works fine.

Then i'm trying to run that program from another program ran in the folder that contains "My Folder" (this program is a launcher).

The problem is that even if i specify correctly the file path (my final .exe is launched, but throws an exception), the working directory or something is not "My folder" and i think that is needed to the properly work of my final application.

How can i correctly launch my final program from the other?

My code is :


Process.Start("\""+@"My Folder\MyFinalProgram.exe"+"\"");


And i've tried things like:


ProcessStartInfo pStartInfo = new ProcessStartInfo();

pStartInfo.WorkingDirectory ="\"" + @"My Folder" + "\"";

pStartInfo.Domain = "\"" + @"My Folder" + "\"";

pStartInfo.FileName = "\"" + @"My Folder\MyFinalProgram.exe" + "\"";

Process.Start(pStartInfo);




Thanks in advance.

Continue reading...
 
Back
Top