Page Rank

Subscribe

Categories

Recent posts

Alexa Rank

Create windows based DOS or Command Prompt in C#


  • This topic shows how to Create windows based DOS or Command Prompt in C#.
  • With this example you can learn, how to read, write data to the command prompt and get data from command prompt and shows on the textbox in C#.

Design a form Create DOS or windows based Command Prompt in C# as shown in figure

Design form to create windows based Command Prompt or DOS in C#

Design form to create windows based Command Prompt or DOS in C#

  • For this add three textboxes

1)      txterror (get error from the command prompt or DOS) (Middle TextBox)

2)      txtresult (get result from the command prompt or DOS) (Top TextBox)

3)      txtcommand (write DOS command to execute) (Bottom TextBox)

System.Diagnostics Namespace – Create windows based DOS or Command Prompt in C#

  • The System.Diagnostics namespace provides classes that allow you to interact with system processes, event logs, and performance counters.
  • The System.Diagnostics namespace also provides classes that allow you to debug your application and to trace the execution of your code.

ProcessStartInfo Class – Create windows based DOS or Command Prompt in C#


  • ProcessStartInfo Class specifies a set of values used when starting a process.
  • ProcessStartInfo is used in conjunction with the Process component. When you start a process using the Process class, you have access to process information in addition to that available when attaching to a running process.

Write below code inside the form loadCreate windows based DOS or Command Prompt in C#

Write below code inside the textbox keydown event (ie txtcommand_KeyDown)Commant prompt in C#

Create windows based DOS or Command Prompt in C# - Complete Code

Create windows based Command Prompt or DOS in C# : Step 1

Create windows based Command Prompt or DOS in C# : Step 1

Create windows based Command Prompt or DOS in C# : Step 2

Create windows based Command Prompt or DOS in C# : Step 2

Create windows based Command Prompt or DOS in C# : Step 3

Create windows based Command Prompt or DOS in C# : Step 3

Create windows based DOS or Command Prompt in C#

 

 

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Leave a Reply

  

  

  

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">