一招儿使你的Win 8/RT关机更加便捷(vbs)

2026-04-21 05:45 栏目: 常见问题 查看( )

假如你是一位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"

一招儿使你的Win 8/RT关机更加便捷(vbs)(图1)

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)."

解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流

郑重申明:某某网络以外的任何单位或个人,不得使用该案例作为工作成功展示!