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. redirect the contents of the command to a file

redirect the contents of the command to a file

Scheduled Pinned Locked Moved C#
3 Posts 3 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
    sanki779
    wrote on last edited by
    #1

    Hi , I need to redirect the contents of the command to a file. I tried doing this using follwing peice of code but it doesnt seem to be working. System.Diagnostics.Process QueryProcess = new System.Diagnostics.Process(); String command = @"ipconfig/all"; QueryProcess.StartInfo.FileName = command; QueryProcess.StartInfo.Arguments = " >c:\\a.txt"; QueryProcess.Start(); QueryProcess.Close(); Kindly look into the problemand tell me the solution ASAP. Thanks and Regards, Sankalp Verma

    Sankalp Verma

    C S 2 Replies Last reply
    0
    • S sanki779

      Hi , I need to redirect the contents of the command to a file. I tried doing this using follwing peice of code but it doesnt seem to be working. System.Diagnostics.Process QueryProcess = new System.Diagnostics.Process(); String command = @"ipconfig/all"; QueryProcess.StartInfo.FileName = command; QueryProcess.StartInfo.Arguments = " >c:\\a.txt"; QueryProcess.Start(); QueryProcess.Close(); Kindly look into the problemand tell me the solution ASAP. Thanks and Regards, Sankalp Verma

      Sankalp Verma

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      You could always stream the StandardOutput to a file - See the docs on MDSN for the System.Diagnostics.Process class


      Upcoming Scottish Developers events: * We are starting a series of events in Glasgow in 2007. Are you interested in a particular subject, or as a speaker? * Developer Day Scotland: are you interested in speaking or attending? My: Website | Blog | Photos

      1 Reply Last reply
      0
      • S sanki779

        Hi , I need to redirect the contents of the command to a file. I tried doing this using follwing peice of code but it doesnt seem to be working. System.Diagnostics.Process QueryProcess = new System.Diagnostics.Process(); String command = @"ipconfig/all"; QueryProcess.StartInfo.FileName = command; QueryProcess.StartInfo.Arguments = " >c:\\a.txt"; QueryProcess.Start(); QueryProcess.Close(); Kindly look into the problemand tell me the solution ASAP. Thanks and Regards, Sankalp Verma

        Sankalp Verma

        S Offline
        S Offline
        Shajeel
        wrote on last edited by
        #3

        try first part of this article http://www.codeproject.com/cs/threads/launchprocess.asp?df=100&forumid=16360&exp=0&select=1079004[^]

        Regards Shajeel

        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