[英]vbs log out with delay
我想在vbscript中延遲注銷我的電腦。 這是我到目前為止所嘗試的:
Dim ObjShell
Set ObjShell = CreateObject("WScript.Shell")
ObjShell = msgbox("Wollen Sie den Computer herunterfahren ?", +vbYesNo+vbExclamation, "")
If ObjShell = 6 then
Set ShellObject = GetObject("winmgmts:{impersonationLevel=impersonate,(Shutdown)}").ExecQuery("select * from Win32_OperatingSystem where Primary=true")
For Each sys In ShellObject
Sys.Win32Shutdown 0
Next
End if
我想知道如何制造延遲。
您可以使用WScript.Exec "shutdown.exe -L -F -t 30"
讓關機完成等待,或者在執行下一個語句之前使用Wscript.Sleep 30000
啟動等待。
在這個例子中,兩次都是30秒。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.