假如你是一位Windows 8用户,那么你会如何来关闭或重新启动你的设备呢?相信很多人都是按照先通过Win+C快捷键呼出Charms边栏,然后再依次点击“设定”和“电源”按钮的方法来实现关机操作。
注意,假如无法正常看到文件扩展名的话,那么请启用Windows 8系统“文件夹选项”中的“显示文件扩展名”功能。
然后将下面这些代码全部复制粘贴到文本当中,而后再将文本文件的文件扩展名由“.txt”修改为“.vbs”,使之成为一个VBS脚本文件,双击运行即可
复制代码代码如下:
set WshShell = WScript.CreateObject("WScript.Shell")
strStartMenu = WshShell.SpecialFolders("StartMenu")
set oShellLink = WshShell.CreateShortcut(strStartMenu & "Shutdown.lnk")
oShellLink.TargetPath = "%systemroot%System32shutdown.exe"
oShellLink.Arguments = "-s -t 0"
oShellLink.WindowStyle = 1
oShellLink.IconLocation = "%systemroot%System32shell32.dll,27"
oShellLink.Description = "Shutdown Computer (Power Off)"
oShellLink.WorkingDirectory = "%systemroot%System32"
oShellLink.Save
Set oShellLink = Nothing
set oShellLink = WshShell.CreateShortcut(strStartMenu & "Log Off.lnk")
oShellLink.TargetPath = "%systemroot%System32shutdown.exe"
oShellLink.Arguments = "-l"
oShellLink.WindowStyle = 1
oShellLink.IconLocation = "%systemroot%System32shell32.dll,44"
oShellLink.Description = "Log Off (Switch User)"
oShellLink.WorkingDirectory = "%systemroot%System32"
oShellLink.Save
Set oShellLink = Nothing
set oShellLink = WshShell.CreateShortcut(strStartMenu & "Restart.lnk")
oShellLink.TargetPath = "%systemroot%System32shutdown.exe"
oShellLink.Arguments = "-r -t 0"
oShellLink.WindowStyle = 1
oShellLink.IconLocation = "%systemroot%System32shell32.dll,176"
oShellLink.Description = "Restart Computer (Reboot)"
oShellLink.WorkingDirectory = "%systemroot%System32"
oShellLink.Save
Set oShellLink = Nothing
Wscript.Echo "Shutdown, Restart and Log Off buttons have been created. You can now pin them to the Start Screen of your Windows 8 computer (if they are not already there)."