【发布时间】:2017-03-26 06:33:33
【问题描述】:
我试图用 vb.net 隐藏 cmd 窗口,但没有成功。
Dim oProcess As New Process()
Dim oStartInfo As New ProcessStartInfo("cmd.exe", " /c cscript ""%windir%\system32\slmgr.vbs"" /xpr | findstr ""The machine""")
oStartInfo.WindowStyle = ProcessWindowStyle.Minimized
oStartInfo.WindowStyle = ProcessWindowStyle.Hidden
oStartInfo.UseShellExecute = False
oStartInfo.RedirectStandardOutput = True
oProcess.StartInfo = oStartInfo
oProcess.Start()
Dim sOutput As String
Using oStreamReader As System.IO.StreamReader = oProcess.StandardOutput
sOutput = oStreamReader.ReadToEnd()
End Using
TextBox4.Text = sOutput
请帮助我的代码中的错误是什么?
【问题讨论】:
标签: vb.net shell command-line cmd hidden