此脚本的目标是:
如果没有第2步,这一切都很有效。发生的事情是,首先是第二步,然后重启机器(步骤1)。我很困惑,这是代码:
nomePosto = InputBox("Nome do posto:", _
"Correção Cert DSM")
intAnswer = _
MsgBox("Ao continuar o posto " & nomePosto & " vai reiniciar!",_
vbOkCancel, "ATENÇÃO")
if intAnswer = vbOk Then
CONST comm1 = " shutdown -r -f -t 1"
CONST comm2 = " md c:\teste"
set wshShell = WScript.CreateObject ("Wscript.Shell")
wshShell.run "psexec \\" & nomePosto & comm1
Set oIE = CreateObject("InternetExplorer.Application")
With oIE
.navigate("about:blank")
.Document.Title = "Aguarde ..." & string(100, chrb(160))
.resizable=0
.height=100
.width=100
.menubar=0
.toolbar=0
.statusBar=0
.visible=1
End With
Do while oIE.Busy
wscript.sleep 500
Loop
oIE.document.body.innerHTML = "<div id=""countdown"" style=""font: 12pt sans-serif;text-align:center;""></div>"
for i=56 to 0 step -1
oIE.document.all.countdown.innerText= i
wscript.sleep 1000
next
wshShell.run "psexec \\" & nomePosto & comm2
oIE.quit
else
end if
Wscript.Quit
答案 0 :(得分:0)
Wscript.sleep 500。
我曾经尝试过这一点并且完全忽略了计算机需要更长时间才能启动,意味着一切都正常工作