Solved

How to create a winform version of the command prompt

Posted on 2010-11-19
2
307 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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 …
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

863 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

25 Experts available now in Live!

Get 1:1 Help Now