现在我有以下脚本工作:脚本显示基于平成功的消息/失败
set WshShell = CreateObject("WScript.Shell")
WshShell.run ("%COMSPEC% /c ipconfig /release"), 0, true
WshShell.run ("%COMSPEC% /c ipconfig /renew"), 0, true
PINGFlag = Not CBool(WshShell.run("ping -n 1 www.google.com",0,True))
If PINGFlag = True Then
MsgBox("ip release/renew was successful")
Else
MsgBox("ip release/renew was not successful")
End If
我不是那熟悉的VBScript,但它似乎是用于显示弹出消息,我最好的选择。我从别人认为我在网上找到拼凑这个剧本,所以我想更多地了解它是如何工作:
我的问题是,我不明白究竟是怎么以下行工作:
PINGFlag = Not CBool(WshShell.run("ping -n 1 www.google.com",0,True))
它是如何确定PINGFlag的布尔值的?
谢谢!
查看关于使用Visual Studio调试WSH脚本我的笔记[这里](http://stackoverflow.com/a/13802548/111794) 。此外,请参阅[这里](http://msdn.microsoft.com/en-us/library/d5fk67ky(v = vs.84).aspx)关于'Run'方法。 –