Process - Invalid

G

Guest

I have the following lines of code:

System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo.FileName = "intupld.exe";
process.StartInfo.Arguments = hupFile;
process.StartInfo.WorkingDirectory = hencePath;

The problem I am running into is, if I run the code as listed above, the
Argument does not seem to be passed to the *.exe file, as a command window is
opened and sits waiting for "input."

However: if I run the code as follows (this is how it was ran under old VB6):
System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo.FileName = "intupld.exe " + hupFile;
process.StartInfo.WorkingDirectory = hencePath;

I get an error of the file not being found.

How would I be able to call this *.exe file and pass in the file argument?

Thanks
Andy
 
S

Stoitcho Goutsev \(100\)

Andy,

The code loks ok to me.
Argument does not seem to be passed to the *.exe file, as a command window
is
opened and sits waiting for "input."
I don't quite understand this.

BTW the Process.Start method has a overload that excepts exe and command
arguments. If you don't do anything special you can use it.
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

The problem I am running into is, if I run the code as listed above, the
Argument does not seem to be passed to the *.exe file, as a command window
is
opened and sits waiting for "input."

I find this difficult to understand, I have more than once execute an
external program with parameters and I have never had any problem.

Also consider using the fullpath to the executable.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top