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'm trying to run

shutdown.exe -l -t 10

only showed shutdown help manual.

I thought of inelegant but working solution of

ping -n 10  localhost
shutdown.exe -l

How wasteful is this solution?

I thought of downloading sleep.exe, but I want my bat file to work on a machine with no previous preparations.

Any more ideas?

Thanks

share|improve this question

migrated from stackoverflow.com May 8 '10 at 2:22

This question came from our site for professional and enthusiast programmers.

    
If it's showing the help manual, that means there is a problem with your syntax - but I can't figure out what it is. Here are the command-line args: computerhope.com/shutdown.htm –  Nathan Osman May 6 '10 at 23:59
    
It works for me, although it doesn't wait 10 seconds for some reason, it just logs out immediately –  Michael Mrozek May 7 '10 at 0:01
    
@Michael: It's not supposed to wait. The -t arg is a timeout not a wait period. –  Nathan Osman May 7 '10 at 1:17

3 Answers 3

It would seem that the -l command is for some reason not compatible with -t.

if you wanted to shutdown the command shutdown -s -t 10 would work, if you wanted to log off after while, you could try using the at command, which schedules a process to be run at a certain time.

at [time] shutdown -l . Not as nice but should work

share|improve this answer

Please note that the -l option just logs you off, it doesn't shutdown nor restart the computer. You could try using

shutdown -l

And it should logoff the computer after 30 seconds.

Anyway, the syntax

shutdown -l -t 10

Is correct, try to copy that line if it doesn't work.

share|improve this answer
    
No, using the -t with -l still just brings up the help details –  Skuld Jun 21 at 7:30

http://sourceforge.net/projects/logout/

Description

Logout is a simple command line utility to silently force close running applications and log off the current Windows user after a provided number of minutes.

example: "logout 24" would log off the current user after 24 minutes.

share|improve this answer
2  
Care to explain a little what this does? –  slhck Apr 29 '12 at 7:07

Your Answer

 
discard

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