Solved

How to create a winform version of the command prompt

Posted on 2010-11-19
2
308 Views
Last Modified: 2013-11-05
I am trying to duplicate a command prompt with winforms.  I can stream the output of the command prompt to the winform's text box.  I know that I need to use something like the attached code.  But what I don't know how to do is :

1.   How to capture user input & responses
2.   How to send user input & responses to the command prompt I am streaming the output from.
3.   How to display the new user input in the text box and continue to stream the output.
     

     
Using p As Process = New Process
            Dim SR As System.IO.StreamReader
            Dim SW As System.IO.StreamWriter
            Dim NTF As Boolean = True

            p.StartInfo.FileName = Path
            p.StartInfo.UseShellExecute = False
            p.StartInfo.Arguments = Arguments
            p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
            p.StartInfo.CreateNoWindow = True
            p.StartInfo.RedirectStandardOutput = True
            p.StartInfo.RedirectStandardInput = True
            p.Start()
            SR = p.StandardOutput
            SW = p.StandardInput

            While Not p.HasExited
                Do Until SR.EndOfStream = True
                    rtb1.AppendText("   " & SR.ReadLine & vbLf)
                    Application.DoEvents()
                Loop
            End While
End Using

Open in new window

0
Comment
Question by:NevSoFly
2 Comments
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
ID: 34179608
0
 

Author Closing Comment

by:NevSoFly
ID: 34364044
sorry for being so late
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question