vbs 调用dos命令

来源:百度知道 编辑:UC知道 时间:2024/09/28 17:57:45
Set R = CreateObject("WScript.Shell")
return=MsgBox ("你确定要重起计算机吗?",vbokcancel+vbexclamation,"注意!")
If return=vbok Then
R.run "ping %computername% -n 6&&ipconfig /release&&ipconfig /renew",0
End if
为什么达不到想要的意思呢:
ping %computername% -n 6&&ipconfig /release&&ipconfig /renew
我就是想让三条命令像在批处理里一样执行。

Set R = CreateObject("WScript.Shell")
return=MsgBox ("你确定要重起计算机吗?",49,"注意!")
If return=vbOK Then
R.run ("%Comspec% /c "& chr(34) & "ping %computername% -n 6&&ipconfig /release&&ipconfig /renew" & chr(34)),0,True
End if

你在ping前加个"cmd /c "试试