Getting command prompt result into textbox

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

    #1

    Getting command prompt result into textbox

    Hello,
    I have a textbox named "textbox1" and a button named "button1"

    How can i retrieve the console (cmd) data into textbox?

    For example when i run Shell("cmd.exe /k dir c:\",AppWinStyl e.Hide)
    when pressed button1, i want the result is displayed into textbox.

    Thanks

  • Cor Ligthert[MVP]

    #2
    Re: Getting command prompt result into textbox

    Set it as parameters in your constructor and use the values.

    Cor

    "kimiraikko nen" <kimiraikkonen8 5@gmail.comschr eef in bericht
    news:1190932418 .698451.15350@r 29g2000hsg.goog legroups.com...
    Hello,
    I have a textbox named "textbox1" and a button named "button1"
    >
    How can i retrieve the console (cmd) data into textbox?
    >
    For example when i run Shell("cmd.exe /k dir c:\",AppWinStyl e.Hide)
    when pressed button1, i want the result is displayed into textbox.
    >
    Thanks
    >

    Comment

    • Michel Posseth  [MCP]

      #3
      Re: Getting command prompt result into textbox


      instead of using shell use the process class

      then

      p.Start
      dim reader as streamreader = p.standardoutpu t
      p.waitforexit
      messagebox.show (reader.readtoe nd)

      hth

      Michel

      "kimiraikko nen" <kimiraikkonen8 5@gmail.comschr eef in bericht
      news:1190932418 .698451.15350@r 29g2000hsg.goog legroups.com...
      Hello,
      I have a textbox named "textbox1" and a button named "button1"
      >
      How can i retrieve the console (cmd) data into textbox?
      >
      For example when i run Shell("cmd.exe /k dir c:\",AppWinStyl e.Hide)
      when pressed button1, i want the result is displayed into textbox.
      >
      Thanks
      >

      Comment

      • Herfried K. Wagner [MVP]

        #4
        Re: Getting command prompt result into textbox

        "kimiraikko nen" <kimiraikkonen8 5@gmail.comschr ieb:
        I have a textbox named "textbox1" and a button named "button1"
        >
        How can i retrieve the console (cmd) data into textbox?
        >
        For example when i run Shell("cmd.exe /k dir c:\",AppWinStyl e.Hide)
        when pressed button1, i want the result is displayed into textbox.
        <URL:http://dotnet.mvps.org/dotnet/samples/misc/RedirectConsole .zip>

        --
        M S Herfried K. Wagner
        M V P <URL:http://dotnet.mvps.org/>
        V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

        Comment

        • kimiraikkonen

          #5
          Re: Getting command prompt result into textbox

          On Sep 28, 6:35 am, "Cor Ligthert[MVP]" <notmyfirstn... @planet.nl>
          wrote:
          Set it as parameters in your constructor and use the values.
          >
          Cor
          >
          "kimiraikko nen" <kimiraikkone.. .@gmail.comschr eef in berichtnews:119 0932418.698451. 15350@r29g2000h sg.googlegroups .com...
          >
          >
          >
          Hello,
          I have a textbox named "textbox1" and a button named "button1"
          >
          How can i retrieve the console (cmd) data into textbox?
          >
          For example when i run Shell("cmd.exe /k dir c:\",AppWinStyl e.Hide)
          when pressed button1, i want the result is displayed into textbox.
          >
          Thanks- Hide quoted text -
          >
          - Show quoted text -
          Could you define more?

          I'm newbie. When i use system.process. diagnostics.sta rt("cmd.exe /k
          dir c:"), i get "cannot find specified file" error while debuggin. If
          i use Shell("cmd.exe /k dir c:\",AppWinStyl e.Hide), no problems for
          running, but i cannot get the results as texts into my textbox.

          Comment

          • kimiraikkonen

            #6
            Re: Getting command prompt result into textbox

            On Sep 28, 8:16 am, "Michel Posseth [MCP]" <M...@posseth.c omwrote:
            instead of using shell use the process class
            >
            then
            >
            p.Start
            dim reader as streamreader = p.standardoutpu t
            p.waitforexit
            messagebox.show (reader.readtoe nd)
            >
            hth
            >
            Michel
            >
            "kimiraikko nen" <kimiraikkone.. .@gmail.comschr eef in berichtnews:119 0932418.698451. 15350@r29g2000h sg.googlegroups .com...
            >
            >
            >
            Hello,
            I have a textbox named "textbox1" and a button named "button1"
            >
            How can i retrieve the console (cmd) data into textbox?
            >
            For example when i run Shell("cmd.exe /k dir c:\",AppWinStyl e.Hide)
            when pressed button1, i want the result is displayed into textbox.
            >
            Thanks- Hide quoted text -
            >
            - Show quoted text -
            Did it but got error : "standard output has not been redirected"

            Comment

            Working...