Using Process.Start with command line parameters

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

    Using Process.Start with command line parameters

    I have an app that calls an eternal EXE using process.start. My issue is I
    have a couple command line parameters that need to be put in, so that it
    would read:

    Process p = new Process();
    p.EnableRaising Events = false;
    p.StartInfo.Wor kingDirectory = "C:\\AutoPM\\Au toD\\"; //**TESTING
    p.StartInfo.Cre ateNoWindow = false;
    p.StartInfo.Win dowStyle = ProcessWindowSt yle.Minimized;

    ProcessStartInf o startInfo = new ProcessStartInf o("AutoDim.exe" , "
    delay=60");
    System.Diagnost ics.Process.Sta rt(startInfo);

    Where the delay=60 is the command line param values.

    Anyone have any ideas or assistance? Thanks
  • Mel

    #2
    Re: Using Process.Start with command line parameters

    it should work, but you can try adding

    p.StartInfo.Arg uments = "delay=60";

    "Rob" <Rob@discussion s.microsoft.com wrote in message
    news:5FCB74AF-58D6-4AA3-B981-22525EA44FCA@mi crosoft.com...
    >I have an app that calls an eternal EXE using process.start. My issue is I
    have a couple command line parameters that need to be put in, so that it
    would read:
    >
    Process p = new Process();
    p.EnableRaising Events = false;
    p.StartInfo.Wor kingDirectory = "C:\\AutoPM\\Au toD\\"; //**TESTING
    p.StartInfo.Cre ateNoWindow = false;
    p.StartInfo.Win dowStyle = ProcessWindowSt yle.Minimized;
    >
    ProcessStartInf o startInfo = new ProcessStartInf o("AutoDim.exe" , "
    delay=60");
    System.Diagnost ics.Process.Sta rt(startInfo);
    >
    Where the delay=60 is the command line param values.
    >
    Anyone have any ideas or assistance? Thanks

    Comment

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

      #3
      Re: Using Process.Start with command line parameters

      Hi,

      What is the problem?

      IT should work fine.

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


      "Rob" <Rob@discussion s.microsoft.com wrote in message
      news:5FCB74AF-58D6-4AA3-B981-22525EA44FCA@mi crosoft.com...
      >I have an app that calls an eternal EXE using process.start. My issue is I
      have a couple command line parameters that need to be put in, so that it
      would read:
      >
      Process p = new Process();
      p.EnableRaising Events = false;
      p.StartInfo.Wor kingDirectory = "C:\\AutoPM\\Au toD\\"; //**TESTING
      p.StartInfo.Cre ateNoWindow = false;
      p.StartInfo.Win dowStyle = ProcessWindowSt yle.Minimized;
      >
      ProcessStartInf o startInfo = new ProcessStartInf o("AutoDim.exe" , "
      delay=60");
      System.Diagnost ics.Process.Sta rt(startInfo);
      >
      Where the delay=60 is the command line param values.
      >
      Anyone have any ideas or assistance? Thanks

      Comment

      • Ben Voigt

        #4
        Re: Using Process.Start with command line parameters


        "Rob" <Rob@discussion s.microsoft.com wrote in message
        news:5FCB74AF-58D6-4AA3-B981-22525EA44FCA@mi crosoft.com...
        >I have an app that calls an eternal EXE using process.start. My issue is I
        have a couple command line parameters that need to be put in, so that it
        would read:
        >
        Process p = new Process();
        p.EnableRaising Events = false;
        p.StartInfo.Wor kingDirectory = "C:\\AutoPM\\Au toD\\"; //**TESTING
        p.StartInfo.Cre ateNoWindow = false;
        p.StartInfo.Win dowStyle = ProcessWindowSt yle.Minimized;
        >
        ProcessStartInf o startInfo = new ProcessStartInf o("AutoDim.exe" , "
        delay=60");
        now you have two ProcessStartInf o objects/structures: p.StartInfo and
        startInfo. Maybe you meant to set startInfo.Worki ngDirectory, etc?
        System.Diagnost ics.Process.Sta rt(startInfo);
        >
        Where the delay=60 is the command line param values.
        >
        Anyone have any ideas or assistance? Thanks

        Comment

        Working...