2016-10-10 102 views
3

我看到有一些與我的問題相關的主題,但缺少一些內容,我需要創建批重新啓動計算機併發送彈出消息;我有這樣的:帶消息延遲的批量重啓

@echo off 
cd c:\windows\system32 
shutdown -r -t 600 -c "Your machine you need to reboot in 5 minutes." -f 
exit 

不過,我需要更多的東西,我需要2分鐘的提醒計算機重新啓動之前,有一種方式,用戶可停止或重新啓動計算機之前,提出一個新的時間。

回答

1

你可以嘗試這樣的事情:

@echo off 
shutdown -r -t 600 -c "Your machine you need to reboot in 5 minutes." -f 
Call :AskQuestion 
exit 
::*********************************************************************** 
:AskQuestion 
(
    echo Set Ws = CreateObject("wscript.shell"^) 
    echo wscript.sleep 180000 
    echo Answ = MsgBox("Did you want to cancel the scheduled reboot of your the computer ?"_ 
    echo ,VbYesNo+VbQuestion,"Did you want to cancel the scheduled reboot of your the computer ?"^) 
    echo If Answ = VbYes then 
    echo  Return = Ws.Run("cmd /c Shutdown -a",0,True^) 
    echo Else 
    echo  wscript.Quit(1^) 
    echo End If 
)>"%tmp%\%~n0.vbs" 
Start "" "%tmp%\%~n0.vbs" 
2
@echo off 
shutdown -r -t 300 -c "Your machine you need to reboot in 5 minutes." 
Echo Press any key to cancel 
timeout /t 180 
Echo 2 mins to go 
timeout /t 9999 
shutdown /a 

對於一般的幫助。在命令提示符下鍵入Help。對於列出的每個命令類型help <command>(例如help dir)或<command> /?(例如dir /?)。