現在我有以下腳本工作:腳本顯示基於平成功的消息/失敗
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'方法。 –