我想在vb.net
下运行cmd hide,代码为打击:
Dim oProcess1 As New Process()
Dim oStartInfo1 As New ProcessStartInfo()
oStartInfo1.Verb = "runas"
oStartInfo1.FileName = "cmd.exe"
oStartInfo1.Arguments = " /c exit /b " & szCode & " | echo %=exitcode% "
'oStartInfo1.CreateNoWindow = True
'oStartInfo1.WindowStyle = ProcessWindowStyle.Hidden
oStartInfo1.UseShellExecute = False
oStartInfo1.RedirectStandardOutput = True
oProcess1.StartInfo = oStartInfo1
oProcess1.Start()
Dim sOutput1 As String
Using oStreamReader As System.IO.StreamReader = oProcess1.StandardOutput
sOutput1 = oStreamReader.ReadToEnd()
End Using
但是当我在CMD下运行时,输出字符串是:%=exitcode%
:
cmd /c exit /b 1074065420 | echo %=exitcode%
输出为:4004F00C
如何在vb.net
下获得正确的结果?