例如说调用avp.exe,我可以直接得到
VB.NET code
StartInfo.Arguments= cmd
StartInfo.UseShellExecute=False
StartInfo.RedirectStandardOutput=True
StartInfo.WindowStyle=ProcessWindowStyle.Normal
Process=NewProcess()
Process.StartInfo=StartInfo
Process.Start()
DimReaderAsStreamReader=Process.StandardOutput
但换成调用avp.com的话,得到的就只有空值。
但在cmd命令行下,两者打印出的结果是一样的,想请问如何得到.com的打印值?
解决方法:
VB.NET code
ProtectedSub Page_Load(sender AsObject, e AsSystem.EventArgs)HandlesMe.Load
Dim sortProcess AsNewProcess()
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 =NewStringBuilder()
AddHandler sortProcess.OutputDataReceived,AddressOfSortOutputHandler
sortProcess.StartInfo.RedirectStandardInput=True
sortProcess.Start()
sortProcess.BeginOutputReadLine()
sortProcess.WaitForExit()
sortProcess.Close()
EndSub
SubSortOutputHandler(sendingProcess AsObject, outLine AsDataReceivedEventArgs)
Dim a AsString= outLine.Data
Response.Write(a)
EndSub