3

In Windows XP or later, How do I make a Desktop Shortcut to Logoff User?

2 Answers 2

8

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.

2
  • 3
    You 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, 2009 at 19:37
  • Oh, and I am only sure this works with XP, but probably works with others as well Oct 28, 2009 at 19:48
0

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).

1
  • 2
    That'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. Oct 28, 2009 at 20:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .