Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
add comment

2 Answers 2

up vote 8 down vote accepted

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.

share|improve this answer
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 '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
    
@Kyle Smith: thanks for pointing that out! –  blank3 Oct 28 '09 at 20:05
add comment

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

share|improve this answer
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. –  Ryan Bolger Oct 28 '09 at 20:40
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.