Click here to Skip to main content
15,905,913 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Is there a way to enter DOS commands in VB 2010 one after the other on the same cmd window (without using Batch files)? Whenever I try to enter a new command, it opens another cmd window. Here is what I currently have:
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim p As New Process
Dim psi As New ProcessStartInfo("cmd.exe", & txtCommand.text)

p.StartInfo = psi
p.Start()
p.WaitForExit()

End Sub
Posted
Updated 18-Apr-13 4:56am
v2

1 solution

You have to open the command prompt once, then you can send commands to it over the StandardInput (a Stream) property of the Process object you created.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900