Command Line in Windows Forms

Anyone,

I have been asked to create a windows form (or multiple) that will allow the end user to run several command lines in one application. Basically the network guys need to be able to have 1 window opened and have 4 command prompts available to use at once.

I know they could open 4 dos windows, but it's a long story.

I would be happy just to know how to build 1. How can I make a windows form in VB.NET 2005 and have basically a dos prompt sitting there waiting for the user to type

Thanks.



Answer this question

Command Line in Windows Forms

  • KevinBurton

    You could start 4 hidden instances of cmd.exe and redirect their input and output to your form. Check out this MSDN article for the technique. There are problems however, it won't be able to capture the output of old DOS programs that write directly to the screen (the majority of them). Carefully test all the tools they need to run from the command line...


  • Scieck

    perhaps you are talking about using a Process/ProcessStartInfo class This basically allows you to execute a program outside of your application...giving it switches etc.....

  • IvanVC

    well you can do this BUT they can only type in when prompted to enter inputs via your application.

    So if you have a project right now, Winforms app, right click on the project then go to properties.

    in the "Output Type" select "Console application" from the drop down list, save and compile - your application will now not only load the GUI but also have a command prompt in the background where any Console.Read() or Console.Write() statements are written in your code, will be re directed to that command prompt Window

    is this what you are after



  • James Minns

    I'm not sure what you mean here.

    What are the tools/controls that are used for this to work Is it a windows app or just console app Console app is simple. I want to place 4 panels into 1 form. Each of the panels will be a separate instance of cmd prompt which the user could use for something like ping www.yahoo.com -t and the can watch all 4 at once through the app window.


  • paso

    Well, thank you for the suggestion. But it doesn't really do much other than make a cmd window outside the form.

    How could I seat that command prompt into the app And I want to put 4 of them in there... for instance, the user may want to run 4 simultaneous pings with -t, and he/she would want to look to the screen and see all of them working at the same time from the one window.


  • Command Line in Windows Forms