Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Shell("C:\Test.bat") End Sub Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged Dim myprocess As New Process Dim StartInfo As New System.Diagnostics.ProcessStartInfo StartInfo.FileName = "cmd" 'starts cmd window StartInfo.RedirectStandardInput = True StartInfo.RedirectStandardOutput = True StartInfo.UseShellExecute = False 'required to redirect StartInfo.CreateNoWindow = True '<---- creates no window, obviously myprocess.StartInfo = StartInfo myprocess.Start() Dim SR As System.IO.StreamReader = myprocess.StandardOutput Dim SW As System.IO.StreamWriter = myprocess.StandardInput SW.WriteLine(TextBox1) 'the command you wish to run..... SW.WriteLine("exit") 'exits command prompt window txtResults.Text = SR.ReadToEnd 'returns results of the command window SW.Close() SR.Close() End Sub End Class
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)