Process - Invalid

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Andy

    #1

    Process - Invalid

    I have the following lines of code:

    System.Diagnost ics.Process process = new System.Diagnost ics.Process();
    process.StartIn fo.FileName = "intupld.ex e";
    process.StartIn fo.Arguments = hupFile;
    process.StartIn fo.WorkingDirec tory = 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.Diagnost ics.Process process = new System.Diagnost ics.Process();
    process.StartIn fo.FileName = "intupld.ex e " + hupFile;
    process.StartIn fo.WorkingDirec tory = 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
  • Stoitcho Goutsev \(100\)

    #2
    Re: Process - Invalid

    Andy,

    The code loks ok to me.[color=blue]
    > Argument does not seem to be passed to the *.exe file, as a command window
    > is
    > opened and sits waiting for "input."[/color]
    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.


    --

    Stoitcho Goutsev (100)

    "Andy" <Andy@discussio ns.microsoft.co m> wrote in message
    news:7B53F252-BAC1-4EA2-84EC-3987B326D67B@mi crosoft.com...[color=blue]
    >I have the following lines of code:
    >
    > System.Diagnost ics.Process process = new System.Diagnost ics.Process();
    > process.StartIn fo.FileName = "intupld.ex e";
    > process.StartIn fo.Arguments = hupFile;
    > process.StartIn fo.WorkingDirec tory = 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.Diagnost ics.Process process = new System.Diagnost ics.Process();
    > process.StartIn fo.FileName = "intupld.ex e " + hupFile;
    > process.StartIn fo.WorkingDirec tory = 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[/color]


    Comment

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

      #3
      Re: Process - Invalid

      Hi,

      [color=blue]
      > 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."[/color]

      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.



      --
      Ignacio Machin,
      ignacio.machin AT dot.state.fl.us
      Florida Department Of Transportation


      Comment

      Working...