Console application question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?VkIgSm9ubmll?=

    #1

    Console application question

    How can I send the Enter or Return keystroke to a VB.Net 2005 console
    application?

    --
    Coding in Sunny Central Florida
  • rowe_newsgroups

    #2
    Re: Console application question

    On May 9, 8:34 am, VB Jonnie <VBJon...@discu ssions.microsof t.com>
    wrote:
    How can I send the Enter or Return keystroke to a VB.Net 2005 console
    application?
    >
    --
    Coding in Sunny Central Florida
    Question 1:
    >From an external application or the application itself?
    Question 2:

    Why?

    Thanks,

    Seth Rowe

    Comment

    • =?Utf-8?B?VkIgSm9ubmll?=

      #3
      Re: Console application question

      Apologies if the question was not clear, I know it sounds simplistic but...

      I have tried launching another program from the console app using Process
      and Process.StartIn fo but the called app does not always work as expected
      with the arguments passed in. When the arguments are run through a command
      prompt it always behaves as expected.

      I tried entering the call to the application with arguments using
      console.writeli ne, but that does not launch the app.

      I tried putting a console.writeli ne(vbcrlf) after the call, but no dice.

      Any suggestions greatly appreciated, thanks.


      --
      Coding in Sunny Central Florida


      "rowe_newsgroup s" wrote:
      On May 9, 8:34 am, VB Jonnie <VBJon...@discu ssions.microsof t.com>
      wrote:
      How can I send the Enter or Return keystroke to a VB.Net 2005 console
      application?

      --
      Coding in Sunny Central Florida
      >
      Question 1:
      >
      From an external application or the application itself?
      >
      Question 2:
      >
      Why?
      >
      Thanks,
      >
      Seth Rowe
      >
      >

      Comment

      • =?UTF-8?B?R8O2cmFuIEFuZGVyc3Nvbg==?=

        #4
        Re: Console application question

        VB Jonnie wrote:
        Apologies if the question was not clear, I know it sounds simplistic but...
        >
        I have tried launching another program from the console app using Process
        and Process.StartIn fo but the called app does not always work as expected
        with the arguments passed in. When the arguments are run through a command
        prompt it always behaves as expected.
        >
        I tried entering the call to the application with arguments using
        console.writeli ne, but that does not launch the app.
        >
        I tried putting a console.writeli ne(vbcrlf) after the call, but no dice.
        >
        Any suggestions greatly appreciated, thanks.
        >
        >
        Use the StandardInput property of the Process object to send input into
        the application.

        --
        Göran Andersson
        _____
        Göran Anderssons privata hemsida.

        Comment

        • =?Utf-8?B?VkIgSm9ubmll?=

          #5
          Re: Console application question

          Use the StandardInput property of the Process object to send input into
          the application.
          I have tried the following code without success.

          Dim proc As Process = New Process()
          With proc.StartInfo
          .FileName = "cmd.exe"
          .UseShellExecut e = False
          .WindowStyle = ProcessWindowSt yle.Normal
          .CreateNoWindow = False
          .RedirectStanda rdInput = True
          .RedirectStanda rdOutput = True
          .RedirectStanda rdError = True
          End With
          proc.Start()
          Dim sIn As StreamWriter = proc.StandardIn put
          sIn.AutoFlush = True

          sIn.WriteLine(P ath.Combine(DPA PP_PATH, DPAPP) & " " & procArgs)

          --
          Coding in Sunny Central Florida


          "Göran Andersson" wrote:
          VB Jonnie wrote:
          Apologies if the question was not clear, I know it sounds simplistic but...

          I have tried launching another program from the console app using Process
          and Process.StartIn fo but the called app does not always work as expected
          with the arguments passed in. When the arguments are run through a command
          prompt it always behaves as expected.

          I tried entering the call to the application with arguments using
          console.writeli ne, but that does not launch the app.

          I tried putting a console.writeli ne(vbcrlf) after the call, but no dice.

          Any suggestions greatly appreciated, thanks.
          >
          Use the StandardInput property of the Process object to send input into
          the application.
          >
          --
          Göran Andersson
          _____
          Göran Anderssons privata hemsida.

          >

          Comment

          • zacks@construction-imaging.com

            #6
            Re: Console application question

            On May 9, 9:50 am, VB Jonnie <VBJon...@discu ssions.microsof t.com>
            wrote:
            Use the StandardInput property of the Process object to send input into
            the application.
            >
            I have tried the following code without success.
            >
            Dim proc As Process = New Process()
            With proc.StartInfo
            .FileName = "cmd.exe"
            .UseShellExecut e = False
            .WindowStyle = ProcessWindowSt yle.Normal
            .CreateNoWindow = False
            .RedirectStanda rdInput = True
            .RedirectStanda rdOutput = True
            .RedirectStanda rdError = True
            End With
            proc.Start()
            Dim sIn As StreamWriter = proc.StandardIn put
            sIn.AutoFlush = True
            >
            sIn.WriteLine(P ath.Combine(DPA PP_PATH, DPAPP) & " " & procArgs)
            You need to create a StreamWriter and associate it with the sub-
            processes standard input. Then, anything you write to the StreamWriter
            will be sent to the subprocesses standard input stream.
            >
            --
            Coding in Sunny Central Florida
            >
            >
            >
            "Göran Andersson" wrote:
            VB Jonnie wrote:
            Apologies if the question was not clear, I know it sounds simplistic but...
            >
            I have tried launching another program from the console app using Process
            and Process.StartIn fo but the called app does not always work as expected
            with the arguments passed in. When the arguments are run through a command
            prompt it always behaves as expected.
            >
            I tried entering the call to the application with arguments using
            console.writeli ne, but that does not launch the app.
            >
            I tried putting a console.writeli ne(vbcrlf) after the call, but no dice.
            >
            Any suggestions greatly appreciated, thanks.
            >
            Use the StandardInput property of the Process object to send input into
            the application.

            Comment

            Working...