Windows optimize

How do I create shutdown shortcuts in Microsoft Windows 7?

Creating shortcuts to shut down or power down a PC running Microsoft Windows 7 is easy, but it does require specific commands. Mark Kaelin shows you how.

One of the most often-requested Microsoft Windows tweaks is for shortcuts that shut down, power down, and restart a Windows session. The procedure for Windows 7 is very similar to that of Vista and XP, but now you can pin those freshly created shortcuts to the Start Menu or the Taskbar or both.

This blog post is also available as a TechRepublic Photo Gallery and TechRepublic download. When I published this back in February 2010, there was some question about whether these shortcuts were needed anymore, but yet it is still a popular tip. Is this a case of old tricks die hard?

Creating a shortcut

Creating a shortcut should be familiar to almost everyone, but we will walk through the process just for clarity. There are other ways to accomplish this task, but this is my preferred method. First, right-click on a clear spot on the desktop and navigate to New | Shortcut, as shown in Figure A.

Figure A

Navigate the menu to create a new shortcut.
When you click the Shortcut menu item, you will arrive at the input screen shown in Figure B. This is where you will enter the specific command strings to make your new shortcut do what you want it to do.

Figure B

Enter the command for your new shortcut.

For our example, we will enter the specific command that will shut down a Windows PC. Type the following command into the box and then click Next.

Shutdown.exe -s -t 00
The next screen (Figure C) asks you to name the shortcut. I suggest you name the shortcut to correspond to the action it will perform. In this case, we name it Shutdown.

Figure C

Give it an appropriate name.

New icon

Technically, you could stop here, but I prefer to give these shortcuts an icon that will help me remember what it is that they do. In Windows 7, changing an icon is similar to how you changed icons in previous versions of the operating system.

Right-click on the icon in question to get the context menu shown in Figure D and then navigate to the Properties menu item.

Figure D

Find Properties on the menu.
From the Properties control panel, shown in Figure E, select the Change Icon button.

Figure E

Select Change Icon.
The next screen (Figure F) will show you a list of potential icons. Choose the one you want to use and click the OK button twice.

Figure F

Choose your icon and click OK.

You should now have a new shortcut on your desktop. When you click the shortcut, your PC will shut down, so make sure you save your work before you test it.

Windows 7 features

One of the nice features of Windows 7 is that you can pin your new shortcut to the Start Menu and/or to the Taskbar. I am a big Taskbar user myself so that is where I want to put it. Right-click the shortcut to get the context menu and click the Pin to Taskbar menu item (Figure G).

Figure G

Pin the shortcut.
Once the shortcut is pinned (Figure H), you will always have access to a quick shutdown.

Figure H

Shut down anytime.

Additional shortcuts

There are several shutdown and power down commands that you can make into shortcuts. Creating shortcuts for these commands works exactly the same as our example shutdown shortcut.

Restart Computer

Shutdown.exe -r -t 00

Lock Workstation

Rundll32.exe User32.dll,LockWorkStation

Hibernate Computer

rundll32.exe PowrProf.dll,SetSuspendState

Sleep Computer

rundll32.exe PowrProf.dll,SetSuspendState 0,1,0

Bottom line

These shortcut tweaks can be real time-savers, that is for sure. Do you take advantage of them? What other little tweaks are you especially fond of and willing to share?

TechRepublic's Windows Vista and Windows 7 Report newsletter, delivered every Friday, offers tips, news, and scuttlebutt on Vista and Windows 7, including a look at new features in the latest version of the Windows OS. Automatically sign up today!

About

Mark Kaelin is a CBS Interactive Senior Editor for TechRepublic. He is the host for the Microsoft Windows and Office blog, the Google in the Enterprise blog, the Five Apps blog and the Big Data Analytics blog.

26 comments
s_georgiev
s_georgiev

C:\Windows\System32\rundll32.exe shell32 SHExitWindowsEx n Where n is: 0 = Log Off 1 = ShutDOwn 2 = Restart 4 = Forced 8 = Poweroff Or: Shutdown command RUNDLL32.EXE user,exitwindows Restart Command - Windows 9x C:\WINDOWS\RUNDLL.EXE user.exe,exitwindowsexec

BrianW619
BrianW619

Need I say more? The only problem is that you have to verify (yes or no) to complete the action.

wltseng
wltseng

Sleep computer does not work for me (Windows 7 Home Premium X64), it hybernates instead off.

bkaye2@comcast.net
bkaye2@comcast.net

Hibernate works fine...Sleep -for me- puts HP laptop into hibernation, also...anyone get the sleep shortcut to work?

kleczerx
kleczerx

How to write a shutdown shortcut that does not effect a workstation powerdown. For example, the same can be effected by holding the shift-key while using the mouse pointer to re-start; effecting a software, not a power, reset.

kake93
kake93

How can I make a shortcut to switch user?

Gis Bun
Gis Bun

Ok. is it just me or is this stuff really necessary? So you neec 2 click instead of one to shutdown Windows through the menu [or 3 for the others]. Sounds like we're getting lazy!

cheril
cheril

This is great, but what I use the most frequently is KEYBOARD shortcuts. How can we make keyboard shortcuts like the old Ctrl+U, etc.

woblytwo
woblytwo

These shortcuts or the command are great for when you are remotely connected to a computer via "Remote Destkop". RDP does not show the shutdown button on the Start menu. I shows "Log Off" for the remote operator. By using the shortcut, you can restart or shutdown the system remotely.

Chris.sayers
Chris.sayers

If you are using a remote desktop connection you can't ahut the PC down via the start menu so I use this shortcut on the desktop of the remote machine, xxxx:\Windows\System32\taskkill.exe /im explorer.exe where xxxx is your system drive

rasilon
rasilon

I'm not convinced that this is a necessary shortcut any more. It used to take several clicks to shut down a computer. In W7, it's two. Click on the Start button and click on "Shut down" . To save 0ne click, You would create a shortcut tht would shut down the computer if inadvertantly launched (two click, by the way). Pinning it to the Start menu makes no sense at all. It saves me nothing. Hank Arnold (MVP)

DvT-Hex
DvT-Hex

for the program would be considerably more useful than how to change the desktop icon for it...or at least a link to the parameter list.

j0204
j0204

Windows Key + Right Arrow. That was the only reason I gave Windows 7 a try.

Mark W. Kaelin
Mark W. Kaelin

These shortcut tweaks can be real time savers, that is for sure. Do you take advantage of them? What other little tweaks are you especially fond of and willing to share?

jwildhair
jwildhair

For a log off, enter "shutdown -l -t 00" That's the letter l, not the number 1. Then the new user has to log on. BTW, -a aborts shutdown (except log off) & -f closes running apps - in XP, anyway.

jwildhair
jwildhair

Patience is a waste of time :)

benoddo
benoddo

I use it all the time to schedule shutdown in unattended mode. Usually if I'm running a job overnight and I want the machine to shutdown once it's finished, I use the -t option and specify the time interval before shutdown occurs. Remember the -t option is in seconds so 3600 seconds equals 1 hour. You can use it in Windows Scheduler to shutdown at a specific time. Also make it the last entry in a batch job to shutdown, reboot or log off.

benoddo
benoddo

Just as with most Windows commands, simply putting a -? at the end of the command (in a DOS window) will display all parameters. For XP they are: C:\>shutdown.exe -? Usage: shutdown.exe [-i | -l | -s | -r | -a] [-f] [-m \\computername] [-t xx] [-c "comment"] [-d up:xx:yy] No args Display this message (same as -?) -i Display GUI interface, must be the first option -l Log off (cannot be used with -m option) -s Shutdown the computer -r Shutdown and restart the computer -a Abort a system shutdown -m \\computername Remote computer to shutdown/restart/abort -t xx Set timeout for shutdown to xx seconds -c "comment" Shutdown comment (maximum of 127 characters) -f Forces running applications to close without warning -d [u][p]:xx:yy The reason code for the shutdown u is the user code p is a planned shutdown code xx is the major reason code (positive integer less than 256) yy is the minor reason code (positive integer less than 65536)

krebs.don
krebs.don

good info on shortcuts. I am only a novice that likes to read TechRepublic. I understand that what I am wishing for would not be a Windows shortcut per se, but clicking a command to restart in safe mode would be a handy tool when troulbeshooting.

Jimmy S
Jimmy S

The targets of these shortcuts work in XP (SP3) and Vista as well.

wltseng
wltseng

Your answer/advice does not have any meaning for me.

wltseng
wltseng

Thanks a lot for your advice, I will try it.

?/\/\?|???\/???
?/\/\?|???\/???

...but the use of the rundll32.exe program in this fashion is ultimately passing random parameters to the function that does the work. This is why it may work for some and not for others or why it may work some of the time but not all of the time. It is poor guidance, in my opinion, to instruct people to create shortcuts that use rundll32.exe without validating that the use of rundll32.exe is correct as per the MS KB articles that were mentioned in the links. If you really want to create shortcuts to do the "shutdown" things, consider checking out e.g. Sysinternals' PsShutdown.