如何获取.com的StandardOutput?

例如说调用avp.exe,我可以直接得到

VB.NET code

        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



但换成调用avp.com的话,得到的就只有空值。

但在cmd命令行下,两者打印出的结果是一样的,想请问如何得到.com的打印值?
cartoonSnail -
  • INlindsey - 2个月前

    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
    
    


    自己动手 丰衣足食

  • pohertez - 2个月前

    http://topic.csdn.net/u/20111111/13/740f9dbc-0ba9-4602-a367-e5fdb2b8c68d.html

    看看对你是否有帮助

  • artineelali - 2个月前

    又换了一种方法
    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")
    
    


    最后read.readtoend是有东西了,不过不是我想要的扫描结果,仅仅是我输入的命令