هذا الكود يقوم بتنفيذ Command Line من Visual Basic 2010
التصميم

خصائص :
Form
Name : form1
Caption : Compare two exe files
TextBox
'Contains the command Line FC
Name : TextBox1
MultiLine : True
Text :
@Echo Off
FC C:\comp\CS.exe C:\comp\Cexe.exe /B
TextBox
'Will contain the Comparison result of the two EXE application files.
Name : TextBox2
MultiLine : True
Text :Comparison Result will display here ...
Button
'Executes the Command Line FC in the TextBox1
Name : Button1
Text : Go
الكود :
' --------------------------------------- ' ' Visual Basic Online Course ------------ ' ' By / evry1.net ------------------------ ' ' on Jan, 2014 -------------------------- ' ' Facebook : fb.com/Visual.Basic.Language ' ' --------------------------------------- ' Public Class Form1 Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click Dim cmdInput As String = TextBox1.Text.Trim & "&" Dim proc As New Process proc.StartInfo.CreateNoWindow = True proc.StartInfo.UseShellExecute = False proc.StartInfo.FileName = "C:\Windows\System32\cmd.exe" proc.StartInfo.Arguments = cmdInput proc.StartInfo.RedirectStandardOutput = True proc.StartInfo.RedirectStandardError = True proc.StartInfo.RedirectStandardInput = True proc.Start() proc.StandardInput.WriteLine(cmdInput) proc.StandardInput.Close() Dim line As String = Nothing Dim lines As Integer = 0 While (proc.StandardOutput.EndOfStream = False) line = proc.StandardOutput.ReadLine() TextBox2.AppendText(line & vbNewLine) lines = lines + 1 End While proc.Close() proc.Dispose() End Sub End Class