vb.net 下如何获取CMD返回的值?
2个回答
展开全部
Sub Main()
Dim myProcess As New Process
Dim startInfo As New ProcessStartInfo("cmd.exe")
startInfo.Arguments = "/c netsh wlan show networks"
'获取无线网卡可以搜索到的无线网络信息
startInfo.UseShellExecute = False
startInfo.RedirectStandardOutput = True
startInfo.CreateNoWindow = True
myProcess.StartInfo = startInfo
myProcess.Start()
myProcess.WaitForExit()
Dim myStreamReader As IO.StreamReader = myProcess.StandardOutput
Dim myStr As String = myStreamReader.ReadToEnd
End Sub
可以参考这个例子
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询