Script to create a Shutdown/Restart/Logoff Windows 8 tile for the Start menu (VBscript)

Introduction

This VBScript shows how to create a Shutdown, Restart and Logoff Windows 8 tile for the Start menu.

Scenarios

Many users would like to shut down or reboot Windows 8 in just one click. This script enables users to click a tile to shut down, restart or log off Windows on the Start menu.

Script

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

When the script finishes running, a dialog box will appear that displays brief information about the execution result of the script.

In the following figure, the shutdown, restart and logoff Windows 8 tile is created successfully.

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 ShutdownShortcutPath 
Dim objShutdownShortcut 
'create a new shortcut of shutdown 
ShutdownShortcutPath = ProgramData & "\Microsoft\Windows\Start Menu\Programs\Shutdown.lnk"Set objShutdownShortcut = objWSHShell.CreateShortcut(ShutdownShortcutPath) 
objShutdownShortcut.TargetPath = SystemRoot & "\System32\shutdown.exe" 
objShutdownShortcut.Arguments = "-s -t 0"'change the default icon of shutdown shortcut 
objShutdownShortcut.IconLocation = SystemRoot & "\System32\SHELL32.dll,27" 
objShutdownShortcut.Save

 

Prerequisite

Windows 8