In Windows XP or later, How do I make a Desktop Shortcut to Logoff User?
2 Answers
I think you could put the following in a cmd file and put that on the desktop (text file with .cmd extension):
shutdown -l
You can type shutdown in the command prompt for other arguments to shutdown to do other things ( like actually shutdown, would be -s ).
If you want to give it the log off icon, copy and then do 'Paste shortcut' and you can then select change icon from the properties. There is the shutdown icon in %SystemRoot%\system32\SHELL32.dll
Update:
I had originally said to use .bat, but the other Kyle (Smith) pointed out that this loads the DOS emulator, so it is slower.
![](../../users/profiles/2561.webp)
- 82,107
- 71
- 302
- 444
-
3You should use .cmd extensions, .bat is run inside the "DOS emulator". You can tell the difference by running start > run > command vs running start > run > cmd. The former is much slower. (Certainly doesn't make a huge difference here, but it's a best-practice. – Kyle Smith Oct 28 '09 at 19:37
-
Oh, and I am only sure this works with XP, but probably works with others as well – Kyle Brandt Oct 28 '09 at 19:48
I'd say it's quite possible that MS don't provide programmatic access to logoff (at least outside of tools like shutdown.exe), and also possible that the reason why is a very good one (potential for abuse, and you can just guarantee that someone somewhere will somehow manage to put it in their Startup Program Group).
![](../../users/profiles/5234.webp)
- 8,937
- 1
- 22
- 36
-
2That's just silly. There are a multitude of ways a user can programmatically log themselves off. Tools like shutdown.exe are just making standard Win32 calls. But you could just as easily make a WMI call, or write a vbscript. – Ryan Bolger Oct 28 '09 at 20:40