Click here to Skip to main content
15,891,689 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hey,

trying to run

shutdown.exe -l -t 10

only showed shutdown help manual.

I thought of unelegant but working solution of

ping -n 10 localhost
shutdown.exe -l

How wasty is that solution?

I thought of downloading sleep.exe, but I want my bat file to work on machine with no previuse preperations.

any more ideas?
Thanks
Posted
Updated 6-May-10 23:38pm
v2

elad2109 wrote:
any more ideas?


I'm not actually sure what you are trying to do but perhaps this information[^] will help you.
 
Share this answer
 
I think you are a victim of Microsoft's woefully inadequate documentation. After a few tests I've come to the conclusion that when -t xx is referred to as a timeout for shutdown it means just that and it does not apply to log off.

You should also test the -f switch as that seems to do the exact opposite of what they say, i.e. with -l -f applications will not be closed automatically. Try it with Notepad and unsaved changes to see what I mean.

Alan.
none
Usage: shutdown [-i | -l | -s | -r | -a] [-f] [-m \\computername] [-t xx] [-c "comment"] [-d up:xx:yy]
        No args                 Display this message (same as -?)
        -i                      Display GUI interface, must be the first option
        -l                      Log off (cannot be used with -m option)
        -s                      Shutdown the computer
        -r                      Shutdown and restart the computer
        -a                      Abort a system shutdown
        -m \\computername       Remote computer to shutdown/restart/abort
        -t xx                   Set timeout for shutdown to xx seconds
        -c "comment"            Shutdown comment (maximum of 127 characters)
        -f                      Forces running applications to close without warning
        -d [u][p]:xx:yy         The reason code for the shutdown
                                u is the user code
                                p is a planned shutdown code
                                xx is the major reason code (positive integer less than 256)
                                yy is the minor reason code (positive integer less than 65536)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900