Ok, so as the title implies, I'm having some trouble with this.... When I use the following code it will run but I can't even use > output.txt to get some status of how it ran....
ProcessStartInfo x = new ProcessStartInfo();
x.FileName = "somefile.exe";
x.Arguments = arg1 + " " + arg2 + " " + arg3 + " " + arg4;
x.WorkingDirectory = workDir;
x.WindowStyle = ProcessWindowStyle.Hidden;
Process mde = Process.Start(x);
mde.WaitForExit();
Now, what's confusing me is that the moment I add in the code for capturing the input, I get thrown an exception stating that the exe file I'm trying to run does not exist. So when I use....
ProcessStartInfo x = new ProcessStartInfo();
x.FileName = "somefile.exe";
x.Arguments = arg1 + " " + arg2 + " " + arg3 + " " + arg4;
x.WorkingDirectory = workDir;
x.WindowStyle = ProcessWindowStyle.Hidden;
modelf.UseShellExecute = false;
modelf.RedirectStandardOutput = true;
Process mde = Process.Start(x);
mde.WaitForExit();
What exactly am I doing wrong here. It's like the working directory property can't be set when the useshellexecute property is used, but from what I read that's not the case. So what's going on? Why can it find the file and execute it properly in the first example and not in the second?