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

link|improve this question
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 – George Edison 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. – George Edison May 7 '10 at 1:17
feedback

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

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

3 Answers

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

link|improve this answer
feedback

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.

link|improve this answer
feedback

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.

link|improve this answer
1  
Care to explain a little what this does? – slhck Apr 29 at 7:07
feedback

Your Answer

 
or
required, but never shown