你好,我要获取XP系统的生产日期,调用CMD,但是在XP系统上运行会卡死,代码如下Dim p As new Process()
Dim strrst As String
Dim scrq As String
p.StartInfo.FileName = "cmd.exe"
p.StartInfo.UseShellExecute = False '关闭Shell的使用
p.StartInfo.RedirectStandardInput = True '重定向标准输入
p.StartInfo.RedirectStandardOutput = True '重定向标准输出
p.StartInfo.RedirectStandardError = True '重定向错误输出
p.StartInfo.CreateNoWindow = True '设置不显示窗口
p.Start()
p.StandardInput.WriteLine("wmic bios get releasedate")
p.StandardInput.WriteLine("exit")
strrst = p.StandardOutput.ReadToEnd()
strrst = strrst.replace(" ","").replace(vbcr,"").Replace(vblf,"") '去掉了空格,换行和回车
Dim ml As String = "releasedate"
strrst = strrst.Remove(0,strrst.LastIndexOf(ml)) '删除从第一个到ml最后一次出现的位置
strrst = strrst.Remove(0,ml.Length * 2)
scrq = strrst.SubString(0,4) & "年" & strrst.SubString(4,2) & "月" & strrst.SubString(6,2) & "日" '得到生产日期
还有获取电脑MAC地址的:wmic nic where netconnectionid!=NULL get macaddress
在XP系统上直接在CMD中可以运行,用狐表调用就不行,是什么问题