An application I am launching with process.start is crashing but when I run it from explorer it runs fine.
Printable View
An application I am launching with process.start is crashing but when I run it from explorer it runs fine.
Do you really think that we should be able to help with so little information? What is the application? What is the code you're using to start it? What is the nature of the crash? We really shouldn't have to prompt you to provide this sort of information.
Quote:
Originally Posted by jmcilhinney
http://img370.imageshack.us/img370/4862/untitledwz8.pngC++ Code:
//COPath = C:\Program Files\Conquer 2.0\Conquer.exe Process p = new Process(); p.StartInfo.FileName = COPath; p.Start();
Is Conquer.exe a game? Many games need to be started form their own program folder because they try to access files assuming that that is the current folder. If it's not then they crash because they fail to find the required files. In that case you'd need this:Note that this applies to any program that assumes that the working folder is the folder containing the executable, but that is most common in games.C# Code:
Process p = new Process(); p.StartInfo.FileName = COPath; p.StartInfo.WorkingDirectory = System.IO.Path.GetDirectoryName(COPath); p.Start();
On a slightly related note, this is why you should never just use a file name alone with no folder path when accessing files in your own code. There's no guarantee that the folder you expect is going to be the working folder, so you should always qualify a file name with a folder path. If you want the folder containing your executable then you should specify that by using Application.StartupPath.
Ok, thankyou.Quote:
Originally Posted by jmcilhinney