我有一个脚本可以在安全模式下重新启动 Windows 计算机。
此 vbscript 调用一个提示 UAC 提升的 BAT 文件,并以安全模式重新启动计算机。
有关如何优化此脚本的任何建议?这可以在 Windows 8 中运行吗?
[code]Dim oShell, retCode
Set oShell = WScript.CreateObject("WScript.Shell")
Set objShell = CreateObject("Wscript.Shell")
retCode = oShell.Popup("Do you want to restart your computer in Safe Mode", 0, "Restart In SafeMode", 4 + 48)
Select Case retCode
case 6, -1
objShell.Run "elevaterestart.bat"
case 7
WScript.quit(1) 'No was chosen
End Select
更新:我按照建议更新了脚本,并Operation Canceled
在用户选择时添加了一个弹出窗口no
Dim oShell, retCode, MsgBox
Set oShell = WScript.CreateObject("WScript.Shell")
Set objShell = CreateObject("Wscript.Shell")
retCode = oShell.popup("Do you want to restart your computer in Safe Mode", 0, "Restart In Safe Mode", 4 + 48 + 256)
If retCode = 6 Or retCode = -1 Then
objShell.Run "elevaterestart.bat"
Else
oShell.popup "Operation Canceled", 0, "Restart In Safe Mode", 0 + 64 + 0
End If`