Solved

How to create a winform version of the command prompt

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
write xml in vb.net 2 32
Get number of Files in Directory and Sub Directories 2 48
VB.NET 2008 Publish Error 2 32
Sql server, import complete table, using vb.net 9 43
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

809 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