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. Visual Basic
  4. Getting DOS output

Getting DOS output

Scheduled Pinned Locked Moved Visual Basic
help
4 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.
  • J Offline
    J Offline
    johnjsm
    wrote on last edited by
    #1

    Hi, I am using the following to redirect the output of a dos command to a richtextbox but anytime I try run it to get the directory listing of a large CD nothing happens but if there is only one file on the CD it works. Can anyone help. Dim myProcess As Process = New Process Dim prgOutput As String ' Output from DOS program myProcess.StartInfo.FileName = "c:\dir.bat" 'Full pathname to including file name myProcess.StartInfo.CreateNoWindow = True ' Does not create a window DOS program myProcess.StartInfo.UseShellExecute = False ' Must be false to redirect output myProcess.StartInfo.RedirectStandardOutput = True myProcess.Start() ' Start the DOS program myProcess.WaitForExit() ' Wait until it completes before moving on prgOutput = myProcess.StandardOutput.ReadToEnd ' Get the DOS output rtbOutput.Text = prgOutput I am using a .bat file which has the following commands: @ECHO OFF d: dir /A /S /O:GNE c: Running the .bat file directly from the command prompt works on the disc with loads of files Thanks

    K S 2 Replies Last reply
    0
    • J johnjsm

      Hi, I am using the following to redirect the output of a dos command to a richtextbox but anytime I try run it to get the directory listing of a large CD nothing happens but if there is only one file on the CD it works. Can anyone help. Dim myProcess As Process = New Process Dim prgOutput As String ' Output from DOS program myProcess.StartInfo.FileName = "c:\dir.bat" 'Full pathname to including file name myProcess.StartInfo.CreateNoWindow = True ' Does not create a window DOS program myProcess.StartInfo.UseShellExecute = False ' Must be false to redirect output myProcess.StartInfo.RedirectStandardOutput = True myProcess.Start() ' Start the DOS program myProcess.WaitForExit() ' Wait until it completes before moving on prgOutput = myProcess.StandardOutput.ReadToEnd ' Get the DOS output rtbOutput.Text = prgOutput I am using a .bat file which has the following commands: @ECHO OFF d: dir /A /S /O:GNE c: Running the .bat file directly from the command prompt works on the disc with loads of files Thanks

      K Offline
      K Offline
      kubben
      wrote on last edited by
      #2

      I did something very similar to this in one of my articles: http://www.codeproject.com/dotnet/OpenFiles.asp[^] Hope that helps. Ben

      1 Reply Last reply
      0
      • J johnjsm

        Hi, I am using the following to redirect the output of a dos command to a richtextbox but anytime I try run it to get the directory listing of a large CD nothing happens but if there is only one file on the CD it works. Can anyone help. Dim myProcess As Process = New Process Dim prgOutput As String ' Output from DOS program myProcess.StartInfo.FileName = "c:\dir.bat" 'Full pathname to including file name myProcess.StartInfo.CreateNoWindow = True ' Does not create a window DOS program myProcess.StartInfo.UseShellExecute = False ' Must be false to redirect output myProcess.StartInfo.RedirectStandardOutput = True myProcess.Start() ' Start the DOS program myProcess.WaitForExit() ' Wait until it completes before moving on prgOutput = myProcess.StandardOutput.ReadToEnd ' Get the DOS output rtbOutput.Text = prgOutput I am using a .bat file which has the following commands: @ECHO OFF d: dir /A /S /O:GNE c: Running the .bat file directly from the command prompt works on the disc with loads of files Thanks

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

        johnjsm wrote:

        myProcess.WaitForExit() ' Wait until it completes before moving on prgOutput = myProcess.StandardOutput.ReadToEnd ' Get the DOS output

        Try changing the order of these two lines

        Cheers, Suresh

        J 1 Reply Last reply
        0
        • S sthotakura

          johnjsm wrote:

          myProcess.WaitForExit() ' Wait until it completes before moving on prgOutput = myProcess.StandardOutput.ReadToEnd ' Get the DOS output

          Try changing the order of these two lines

          Cheers, Suresh

          J Offline
          J Offline
          johnjsm
          wrote on last edited by
          #4

          I did what you suggested and it works. Thnaks for your help.

          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