Script to create a Windows 8 hibernation tile for the Start menu (VBScript)

Introduction

This VBScript shows how to create a Windows 8 Hibernation tile for the Start menu.

Scenarios

Correctly hibernating Windows 8 without a Start button can be difficult. Many users may want to hibernate Windows in just one click. This script enables users to click a tile to hibernate Windows on the Start menu.

Note

You must follow these steps before you can execute this script:

Make sure that the system has hibernation enabled. To confirm, Press Windows key + R. Then, locate the Run menu and type Powercfg.cpl. Then, click OK. In Power Options Properties, click the Hibernate tab and make sure that Enable hibernation option is checked. Click OK/Apply.

Script

Step1: Double-click CreateWindowsHibernationTile.vbs to run this VBScript sample. The step is shown in the following figure.

When the script finished, a window that displays brief information about the execution result of script will appear.

The result is shown in the following figure.

Here are some code snippets for your references. To get the complete script sample, please click the download button at the beginning of this page.

VB Script
Edit|Remove
Dim HibernationShortcutPath 
Dim objHibernationShortcut 
'create a new shortcut of Hibernation 
HibernationShortcutPath = ProgramData & "\Microsoft\Windows\Start Menu\Programs\Hibernation.lnk"Set objHibernationShortcut = objWSHShell.CreateShortcut(HibernationShortcutPath) 
objHibernationShortcut.TargetPath = SystemRoot & "\System32\rundll32.exe" 
objHibernationShortcut.Arguments = "powrprof.dll,SetSuspendState"'change the default icon of Hibernation shortcut 
objHibernationShortcut.IconLocation = SystemRoot & "\System32\SHELL32.dll,297" 
objHibernationShortcut.Save

Prerequisite

Windows 8