Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I remember there is (or was) a command involving rundll32 that calls Windows XP's 'Turn Off Computer' menu – the one that can also be invoked by going to Start Menu > Turn Off Computer.

enter image description here

Does anyone happen to know/remember what the command is?

P.S.: I'm not talking about the 'shutdown' command.

Final edit: Well, the closest command to get this result with rundll32 is the following:

rundll32 msgina.dll,ShellShutdownDialog

But note that you'll get the 'classic' menu/dialog instead of the modern, 'themed' version. You can get the latter using a VBScript one-liner posted by techie007 below.

share|improve this question
    
Are you sure that was not in Windows 95/98/ME? I think it was replaced, and the functionality removed. robvanderwoude.com/rundll.php I tried the one for shutdown, and it errors out. –  KCotreau Jul 15 '11 at 19:07
    
@KCotreau: No, I'm not sure, actually. I just have blurry keywords in my memory. –  Larssend Jul 16 '11 at 15:19
    
I looked VERY hard to find your answer, but I could not. I am not sure you can any more. –  KCotreau Jul 16 '11 at 15:47
    
@KCotreau: Sorry for getting you worked up, then. I think I'm giving up on this as well. Thanks for trying to help. –  Larssend Jul 17 '11 at 11:40
    
No problems. I was just letting you know by saying "VERY", that I did not give it a cursory look, so you would not likely find that, and maybe you might not want to kill yourself looking. As far as getting worked up, I have enjoyed answering questions, and it is questions like yours that have made me learn more. –  KCotreau Jul 17 '11 at 12:27

4 Answers 4

up vote 5 down vote accepted

As others have rightfully pointed out, those commands don't work and/or shouldn't be used.

Here's an option, you can use scripting to call that shutdown dialog/menu (it just pops up the shutdown menu; it doesn't select any action). Here's a couple basics to get you started:

VBS:

CreateObject("Shell.Application").ShutdownWindows

Save as Something.vbs and run it with cscript Something.vbs.

PowerShell:

(New-Object -ComObject Shell.Application).ShutdownWindows();

You can get PowerShell 2.0 for XP (etc.) from MS here (KB968930).

These should work on all versions of XP and up (the VBS may work on Windows 2000 as well). I tested them on Windows 7 (Ultimate) and they worked.

share|improve this answer
    
Good find. The VBScript one-liner does what I want. Thanks a bunch. –  Larssend Jul 18 '11 at 9:11

Before XP, there was a command, rundll32.exe shell32.dll,SHExitWindowsEx 1. It use to still work in XP. It doesn't work in my XP VM though. . .

Starting with XP, Microsoft includes the shutdown command, which does exactly what you want, and more. It works with remote computers, etc etc.

Edit:

There is the more popular Lock Computer command that a lot of ppl don't know about.

rundll32.exe user32.dll, LockWorkStation

edit:

http://blogs.msdn.com/b/oldnewthing/archive/2004/01/15/58973.aspx

Aparently, the above is a no no. So looks like we are stuck with PsShutdown.

share|improve this answer
    
The point of my comment above was that that very command does not work. –  KCotreau Jul 15 '11 at 19:11
    
I didn't see your comment when I posted. Abort, Retry, Fail. –  surfasb Jul 15 '11 at 19:13
    
No worries. :). –  KCotreau Jul 15 '11 at 19:24
1  

Again, as in my comments, I believe that has been superseded primarily by the shutdown command, which you clearly know about.

If you would like alternatives, try these:

shutdown -i (to make it interactive, although not the screen you wanted)

WMIC OS Where Primary=TRUE Call Shutdown (I tested this, works 100%)

WMIC OS Where Primary=TRUE Call Reboot

Not sure if WMIC is on XP Home though.

share|improve this answer

Well if you have focus on the desktop and you hit ALT+F4 that should invoke the 'Turn Off Computer' menu.

share|improve this answer

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.