Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. recieving output from dos

recieving output from dos

Scheduled Pinned Locked Moved C#
question
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sharpiesharpie
    wrote on last edited by
    #1

    how can i run a process from my program and get it's output? as in running "ipconfig" and getting what was written in the dos window?

    S D S 3 Replies Last reply
    0
    • S sharpiesharpie

      how can i run a process from my program and get it's output? as in running "ipconfig" and getting what was written in the dos window?

      S Offline
      S Offline
      szukuro
      wrote on last edited by
      #2

      You can use the "> filename" option for this which will save the output to a file. Example:
      C:\>ipconfig > ip.txt

      1 Reply Last reply
      0
      • S sharpiesharpie

        how can i run a process from my program and get it's output? as in running "ipconfig" and getting what was written in the dos window?

        D Offline
        D Offline
        Dan Neely
        wrote on last edited by
        #3

        If you need something more interactive, the System.Diagnostics.Process class allows you to replace the default input and output streams that goto the application. In theory (I've never tried) this would allow you to fully automate any command line app by analyzing screen scrapings to feed it new input.

        -- CleaKO The sad part about this instance is that none of the users ever said anything [about the problem]. Pete O`Hanlon Doesn't that just tell you everything you need to know about users?

        1 Reply Last reply
        0
        • S sharpiesharpie

          how can i run a process from my program and get it's output? as in running "ipconfig" and getting what was written in the dos window?

          S Offline
          S Offline
          Stefan Troschuetz
          wrote on last edited by
          #4

          Process.StandardOutput Property[^] Take a look at the first example. It shows how to read from a redirected stream and wait for the child process to exit.


          "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook

          www.troschuetz.de

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups