StartInfo.Arguments = cmd
StartInfo.UseShellExecute = False
StartInfo.RedirectStandardOutput = True
StartInfo.WindowStyle = ProcessWindowStyle.Normal
Process = New Process()
Process.StartInfo = StartInfo
Process.Start()
Dim Reader As StreamReader = Process.StandardOutput
VB.NET code
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
Dim sortProcess As New Process()
sortProcess.StartInfo.FileName = "C:\Program Files (x86)\Kaspersky Lab\Kaspersky Anti-Virus 6.0 for Windows Servers MP4\avp.com"
sortProcess.StartInfo.Arguments = " scan c:\1.rar /i3 /fa"
sortProcess.StartInfo.UseShellExecute = False
sortProcess.StartInfo.RedirectStandardOutput = True
sortOutput = New StringBuilder()
AddHandler sortProcess.OutputDataReceived, AddressOf SortOutputHandler
sortProcess.StartInfo.RedirectStandardInput = True
sortProcess.Start()
sortProcess.BeginOutputReadLine()
sortProcess.WaitForExit()
sortProcess.Close()
End Sub
Sub SortOutputHandler(sendingProcess As Object, outLine As DataReceivedEventArgs)
Dim a As String = outLine.Data
Response.Write(a)
End Sub
http://topic.csdn.net/u/20111111/13/740f9dbc-0ba9-4602-a367-e5fdb2b8c68d.html
看看对你是否有帮助
又换了一种方法
VB.NET code
Dim StartInfo As ProcessStartInfo
Dim Process As Process
Dim cmd As String = " scan " & HttpFile & " /i3 /fa"
StartInfo = New ProcessStartInfo()
StartInfo.FileName = "cmd.exe" 'C:\Program Files (x86)\Kaspersky Lab\Kaspersky Anti-Virus 6.0 for Windows Servers MP4\avp.com
'StartInfo.Arguments = cmd
StartInfo.UseShellExecute = False
StartInfo.RedirectStandardInput = True
StartInfo.RedirectStandardOutput = True
StartInfo.RedirectStandardError = True
StartInfo.CreateNoWindow = True
Process = New Process()
Process.StartInfo = StartInfo
Process.Start()
Process.StandardInput.WriteLine("C:\Program Files (x86)\Kaspersky Lab\Kaspersky Anti-Virus 6.0 for Windows Servers MP4\avp.com scan " & HttpFile & " /i3 /fa")
Process.StandardInput.WriteLine("exit")