位置:首页 > 学习课堂 > 电脑学习

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

时间:2020-08-04 07:22:23  来源:老课堂

如果你是一位Windows 8用户,那么你会如何来关闭或重新启动你的设备呢?相信很多人都是按照先通过Win+C快捷键呼出Charms边栏,然后再依次点击“设定”和“电源”按钮的方法来实现关机操作。

不过,近日有来自XDA开发者论坛的用户分享了一种更加简单的关机/重启方法,并表示该方法适合所有运行Windows 8/RT操作系统的PC及平板电脑。

据该用户介绍,这种方法的基本思路是通过一段VBS脚本代码来为Windows 8的开始屏幕添加具备关机/重启功能的“磁贴”,从而实现更加直观快捷的操作。

具体来说,用户首先要新建一个任意名字的空白TXT文本(如Shutdown.txt),然后将下面图片中所显示的这些代码全部复制粘贴到文本当中,而后再将文本文件的文件扩展名由“.txt”修改为“.vbs”,使之成为一个VBS脚本文件。

注意,如果无法正常看到文件扩展名的话,那么请启用Windows 8系统“文件夹选项”中的“显示文件扩展名”功能。

最后,用户只需要双击运行刚才这个VBS脚本文件,就能够在Windows 8/RT系统就会在开始屏幕中创建具备关机/重启功能的“磁贴”。

另外,从目前XDA论坛的用户反馈来看,这种方法确实有效,所以欢迎大家也都动手体验试用。

然后将下面这些代码全部复制粘贴到文本当中,而后再将文本文件的文件扩展名由“.txt”修改为“.vbs”,使之成为一个VBS脚本文件,双击运行即可

复制代码

代码如下:

set WshShell = WScript.CreateObject("WScript.Shell")

strStartMenu = WshShell.SpecialFolders("StartMenu")

set oShellLink = WshShell.CreateShortcut(strStartMenu & "/Shutdown.lnk")

oShellLink.TargetPath = "%systemroot%/System32/shutdown.exe"

oShellLink.Arguments = "-s -t 0"

oShellLink.WindowStyle = 1

oShellLink.IconLocation = "%systemroot%/System32/shell32.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%/System32/shutdown.exe"

oShellLink.Arguments = "-l"

oShellLink.WindowStyle = 1

oShellLink.IconLocation = "%systemroot%/System32/shell32.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%/System32/shutdown.exe"

oShellLink.Arguments = "-r -t 0"

oShellLink.WindowStyle = 1

oShellLink.IconLocation = "%systemroot%/System32/shell32.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)."

老课堂部分文章转载自互联网,供读者交流和学习,若有涉及版权等问题请及时与我们联系,以便删除办理。感谢所有提供资讯的网站,欢迎各类媒体与老课堂进行共享合作。