Hi,

I have some coding which just runs cmd commands.

Code:
 Private Sub RunCMD()
        Dim myProcess As Process = New Process
        Dim s As String
        myProcess.StartInfo.FileName = "c:\windows\system32\cmd.exe"
        myProcess.StartInfo.UseShellExecute = False
        myProcess.StartInfo.CreateNoWindow = True
        myProcess.StartInfo.RedirectStandardInput = True
        myProcess.StartInfo.RedirectStandardOutput = True
        myProcess.StartInfo.RedirectStandardError = True
        myProcess.Start()

        Dim sIn As System.IO.StreamWriter = myProcess.StandardInput
        Dim sOut As System.IO.StreamReader = myProcess.StandardOutput
        Dim sErr As System.IO.StreamReader = myProcess.StandardError

        sIn.AutoFlush = True
        sIn.Write("Insert Command Here" & System.Environment.NewLine)
        sIn.Write("exit" & System.Environment.NewLine)

        s = sOut.ReadToEnd()

        If Not myProcess.HasExited Then
            myProcess.Kill()
        End If
   
        sIn.Close()
        sOut.Close()
        sErr.Close()
        myProcess.Close()

    End Sub

    Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click

        Dim processThread As New Threading.Thread(AddressOf RunCMD)
        processThread.IsBackground = True
        processThread.Start()

End Sub
Now the code works perfectly fine but would it be possible to make the coding shorter or is there any extra coding which I can remove?