Solved

How to create a winform version of the command prompt

Posted on 2010-11-19
2
304 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
Comment Utility
0
 

Author Closing Comment

by:NevSoFly
Comment Utility
sorry for being so late
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

743 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now