Jump to content
xisto Community
Sign in to follow this  
NilsC

Shut Down, Restart, Log Off Xp Using A Batch File Undocumented feature for XP

Recommended Posts

This is a copy of a tutorial I created for Xisto.com. I'm copying it here as a courtesy to Xisto members. :)

How to shutdown a XP Pro computer when you are connected using RDC (Remote Desktop Connection) using a batch file or RPC (Remote Procedure Command) This is useful if you can't get to the computer but have remote access to the computer via a network or the internet.

 

First To show you what you will see at a command prompt (command.com) when you type: "shutdown /?" Without the " " on each end. :)

 

c:\>shutdown /?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)

This is an undocumented feature in XP so I have not found any writeup about it on M$ and everything used here is from other sources. Do not use "cmd" to start the command interpreter (cmd.exe), but type "command" for (command.com. Now you can shutdown the computer by typing "shutdown -s" or to restart the computer type "shutdown -r"

 

To create a batch file for this you can use notepad, and save the file as .bat in c:\ (root directory) Here are the 3 most used batch files for shutdown:

1 save as down.bat

shutdown -s
2 save as restart.bat

shutdown -r
3 save as forcedown.bat

shutdown -f
4 save as logoff.bat

shutdown -l
5 save as rpcdown.bat (replace computername with the name of your computer :P )

shutdown -s -m \\computername
and this last one is fun in an enviroment using RPC :D

 

So that's a piece of cake, the other options are self explanatory and if you need any help creating the batch file, ask and someone will help :P

 

Nils


This is from Xisto tutorial I made http://forums.xisto.com/topic/82716-shut-down-restart-log-off-xp-using-a-batch-file-undocumented-feature-for-xp/&

 

Nils

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.