alternatives to System.Diagnostics.Process.Start when command is too long
- by Frank Schwieterman
I have some code which is generating a rather long command that is being sent to System.Diagnostics.Process.Start(). The call fails with a Win32Exception, message "The filename or extension is too long". The path to the program itself is not very long, but the parameters passed in are quite long. I am calling the version where an instance of ProcessStartInfo is passed as the parameter, and in this case its the ProcessStartInfo.Arguments .Field that is very long. (other parameters: CreateNoWindow = true, UseShellExecute = false, RedirectStandardError = true).
It looks like the exception is coming from a call to win32 function CreateProcess.
Does anyone have an idea of another way to start the process?