我试图通过运行此代码来获取cmd的Windows许可证状态
Dim oProcess As New Process()
Dim oStartInfo As New ProcessStartInfo("cmd.exe", " /c cscript ""%windir%\system32\slmgr.vbs"" /xpr | findstr ""The machine""")
oStartInfo.CreateNoWindow = True
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
Select Case sOutput
Case Is = "The machine is permanently activated."
TextBox4.Text = "activated"
End Select
代码工作正常,但我的textbox4上显示的结果是:机器被永久激活。我需要把这个结果带到案例陈述
Select Case sOutput
Case Is = "The machine is permanently activated."
TextBox4.Text = "activated"
如果我得到我需要的全部机器被永久激活。来自cmd的状态然后显示在textbox4字(激活)