Win32Exception at Process.Start()

  • Thread starter Thread starter =?iso-8859-1?q?Leonel_Gal=E1n?=
  • Start date Start date
?

=?iso-8859-1?q?Leonel_Gal=E1n?=

When doing Process.Start(), I get "The parameter is invalid"
Win32Exception when opening a particular exe. This exe works good in
Windows (cmd.exe).

The exe is "SPIM.exe" as the Simulator for the MIPS assembling language
(http://www.cs.wisc.edu/~larus/spim.html).

I know that maybe that particular file has something strange, but I
thought someone could give me some advice.

Thanks,
 
Hi Leonel,

It sounds to me like you're missing or have used an incorrect command-line
argument.
 
Hi Leonel,
can you post complete example code so it makes your issue easier to resolve.

Thanks
Mark.
 
It appears that SPIM.exe is a CYGWIN application. And there is some
trouble with that. I'm not familiar with UNIX applications or CYGWIN
for running them on Windows, I thought it was a normal Win App. Maybe
someone familiar with this stuff can give me some advice.

The code it's just:

Process p = new Process();
p.StartInfo.FileName = "SPIM.exe";
p.Start();
 
Hi Leonel,

Try setting p.StartInfo.UseShellExecute to false.

--
Dave Sexton

It appears that SPIM.exe is a CYGWIN application. And there is some
trouble with that. I'm not familiar with UNIX applications or CYGWIN
for running them on Windows, I thought it was a normal Win App. Maybe
someone familiar with this stuff can give me some advice.

The code it's just:

Process p = new Process();
p.StartInfo.FileName = "SPIM.exe";
p.Start();
 
Actually I was trying to capture console output so I use that command
and others like

RedirectStandardOutput = True

But trying to make it simplier I notice that just the Start() command
and the exception is thrown.
 
Hi Leonel,

Well, since you can execute it using cmd.exe (as you wrote in the OP), try the
following:

Process process = Process.Start(
Environment.ExpandEnvironmentVariables("%comspec%"), "/C SPIM.exe");

System.Threading.Thread.Sleep(200);
process.Close();

It's not a pretty solution, however.

If you don't have the comspec environment variable defined, then you can try
@"%windir%\system32\cmd.exe" instead. In this case, you might have to specify
the path for SPIM.exe as well.

HTH

(I'm running out of ideas ;)

--
Dave Sexton

Actually I was trying to capture console output so I use that command
and others like

RedirectStandardOutput = True

But trying to make it simplier I notice that just the Start() command
and the exception is thrown.
 
Back
Top