Loading...


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

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

 
 Discussion by NilsC with 33 Replies.
 Last Update: January 7, 2010, 1:17 am ( View Rated (1) ) (View Latest)
Page 1 of 2 pages.
bookmark - Shut Down, Restart, Log Off XP Using A Batch File Undocumented feature for XP  
Quickly Post to Shut Down, Restart, Log Off XP Using A Batch File Undocumented feature for XP w/o signup Share Info about Shut Down, Restart, Log Off XP Using A Batch File Undocumented feature for XP using Facebook, Twitter etc. email your friend about Shut Down, Restart, Log Off XP Using A Batch File Undocumented feature for XP Print
Reply / Comment New Discussion / Topic Share / Bookmark E-Mail a Friend Print


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. :)

CODE

c:\>shutdown /?
Usage: SHUTDOWN [-i | -l | -s | -r | -a] [-f] [-m \\computername] [-t xx] [-c "c
omment"] [-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

CODE

shutdown -s

2 save as restart.bat

CODE

shutdown -r

3 save as forcedown.bat

CODE

shutdown -f

4 save as logoff.bat

CODE

shutdown -l

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

CODE

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

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 ;)

Nils

   Thu Mar 24, 2005    Reply         

Any idea how to force a standby NilsC. I've been searching and so far no luck. Id that what the -f command does (I haven't actually tried that one yet, it seems to be just shutdown with a force quit of apps).

   Thu Mar 24, 2005    Reply         

This may sound like a stupid question, it's not ment to be.

What do you mean by "force a standby" can you define what this term covers?

The -f forces a shutdown, the problem is it does not let programs finish and close in the normal way, it forces (terminates) them and shut the computer down. so any excel or other file you forgot to save is lost. Normal shutdown will prompt you to save a file -f bypasses all that.

Nils

   Thu Mar 24, 2005    Reply         


By force a standby, I mean use a shortcut, command prompt command, batch file, whatever, something other than Start->Turn Off Computer->Standby to place the computer in standby mode. And, this is a long shot, I know, but do you know where the restart icon can be found?

   Thu Mar 24, 2005    Reply         

Just want to make yours batch files more accessible and convenient to use. Just right-click on each of those batch files and assign a shortcut for it. Next time use it, just press the combination of keys that you have made.

Cheers

   Fri Mar 25, 2005    Reply         

for even faster access, create a shortcut file for each batch and put them in a folder. Right click on the Taskbar and go to toolbars New Toolbar... pick the folder you have the shortcuts in. Then right click the toolbar and deselct show title and showtext to save space

   Sat Mar 26, 2005    Reply         


Is there any way to make a batch file that will lock the computer? (Basically hit windows key+L).

   Tue Apr 19, 2005    Reply         

cool, thanks for this! its much more faster to double click a shortcut to a batch file to shutdom the computer or something, rather than click on the start, click on the turn off computer and then finally come to the three options to shutdown.

i would like to add, if you are really lazy like me you can make a shortcut and give the shortcut a global hotkey in the shortcut properties. it will be like "CTRL + ALT + (any key you like)" once you press these keys together it will shutdown, hibernate, restart, or standby the computer - simply with three buttons!







   Mon Apr 25, 2005    Reply         

This one will certainly come in handy as we work with nearly 400 computers on our network and it is difficult keeping up with which ones have remote access enabled.

Plus when we tell the staff to log out and they dont we can just chuck the batch file at them!!!

Thanks

   Tue Oct 11, 2005    Reply         

what priviledges must an computer connected to network have on remote computer to force that remote computer to shutdown? do that remote computer need's to have that
"allow remote assistance invitations to be sent from this computer" and
"allow users to connect remotely to this computer"
boxes checked?
:mellow:

   Tue Oct 11, 2005    Reply         

I would like to know how to create a batch file that shuts down the computer or it can be done through regedit



-vikas sinha

   Thu Nov 1, 2007    Reply         

Hello,
I did a Google search to find some batch codes to specifically and only Save/force a shut down of a specific Excel file name and re-open the same Excel workbook.
Can someone help out please ?
Excel will freeeze on some occasions and I have a On Error in VBA module, so when it does error, it needs to shutodown and re-open.
I can take care of the macro when the workbook opens again, but not sure how a batch file can automatically do the shutdown and re-open task.

Thanks.

   Tue Dec 4, 2007    Reply         

Hey, I Got some questions for you guys cause I fix computers and I'm kinda of Lazy - but sometimes i have to do a stupid batch file for something like AIDA2/Everest, RealVNC, Norton Ghost, network logon/logoff, working with shares, backup up files, network commands, regedits, etc. I'm not the brightest guy nor am I geek - just another IT peon. Well here goes:

1) Does this work on XP Home or tablet/media center edition?
2) Is there something for W2k or Vista?
3) Can you shutdown everybody in the network - what are the setting that have to be setup on the other PC's - services, permissions, etc.?
4) I've tried created shorcuts which could be copied to clients with little success - is there a 3rd party program which can make shortcuts for different windows versions?
5) Is there a way to make the key shorcuts CTRL + ALT + ?? to a file.reg that can be added when needed and removed afterwards?
6) How about logoff current user, and take screenshots?
6) How about has anyone tried creating the batch files, installed them remotely via .reg files, and created scheduled tasks to implement them?

Well I don't know where I'm getting at - just thinking out loud. But here is some homework for you. Let me know if you have any success. If I don't have anything to do this week I'll look into it. :rolleyes:


Levimage

   Wed Dec 5, 2007    Reply         

what about one of the scripting engines.... like VBScript???

   Wed Dec 5, 2007    Reply         

QUOTE (polarysekt)

what about one of the scripting engines.... like VBScript???
Link: view Post: 114815


Yes, whatever works, but how does it work ?

Some of us are no bertter than recording a macro and some tweaks thereafter, and to be honest, that's too much !

   Wed Dec 5, 2007    Reply         

I need to create a batch file to force a shut down on some servers. Once the shutdown is run, then I need to ping for the server name until it comes up timed out or unreachable, then send me an email informing that this is complete. Anyone have any thoughts?

-crzyjim

   Fri Dec 7, 2007    Reply         

QUOTE (NilsC)

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. ;)

CODE

c:\>shutdown /?
Usage: SHUTDOWN [-i | -l | -s | -r | -a] [-f] [-m \\computername] [-t xx] [-c "c
omment"] [-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)

Link: view Post: 24003


you can write them in a text file like "shutdown.txt" and then save it . ^_^
now rename the file to "shutdown.txt.bat" .
a dilolog box apare and chek it yes.then run that file .
you find it intresting. ;)

   Mon Dec 24, 2007    Reply         

timed reboot batch file???
Shut Down, Restart, Log Off XP Using A Batch File

I am needing a reboot batch file that will reboot the computer after say about 2 hours, I have gotten that far, but what I cant figure out is how to get the message box to pop up right before the comp shuts down instead of having stay up for the entire time that the batch file is set for.

Is this possible???

Blaze

-Blaze

   Sun Jan 20, 2008    Reply         

Backup then shutdown .bat file?
Shut Down, Restart, Log Off XP Using A Batch File

I'd like a quick and easy way to automatically save several files to the backup hard drive when shutting down the computer.



About six months ago a columnist had the script for a .Bat file and I can't find it now.



Thanks.



-Flier

   Sat Feb 9, 2008    Reply         

You can also play a hilarious prank with this.

>Right click on the Desktop
>Choose New
>Choose Shortcut
>Type "shutdown.exe -s -t 60 -c "THIS COMPUTER HAS DETECTED A VIRUS!" (Without the quotes, 60 is the amount of time before the command initiates so it can be modified and the text in the quotes (the quotes around THIS COMPUTER HAD DETECTED A VIRUS are needed by the way) can be modified.
>Once you are finished typing that, click ok
>Right click the shortcut on the Desktop
>Click Properties
>Go to "Change Icon"
>A message will appear, just click OK.
>Scroll to the Internet Explorer icon.
>Select it and click ok.
>Click ok.
>Now, if you delete the original Internet Explorer Icon, and change the name of your new shortcut to Internet Explorer, you can play a hilarious prank on someone by making them think their computer has a malicious virus! I've done it on my teachers. It's very funny.

   Tue Mar 18, 2008    Reply         

Replying to vizskywalker

Did you every get an anwser regarding how to force standby mode from a batch file?

Thanks,
Shawn

-reply by Shawn Moorman

   Mon Mar 24, 2008    Reply         

Spamming by shutdown :O
Shut Down, Restart, Log Off XP Using A Batch File

When I use the command
" Shutdown -f "
Is just spamming
" shutdown -I -s -f -t 20 "
All the time, and nothing happens, why?

- Windows xp ( PRO ), sp2

   Tue Apr 1, 2008    Reply         

RE timed reboot bach file
Shut Down, Restart, Log Off XP Using A Batch File

To have a pop up box right before shutdown you type the code -c in the code like below :

Shutdown -f -t 60 -c "this is where the pop will arise"

Play around with it and I hope it answers your question!

-reply by h4ox3r

   Wed Jun 11, 2008    Reply         

PortableApps
Shut Down, Restart, Log Off XP Using A Batch File

Did you know that if you have the latest version of the portableapps menu, and a program called QuickBFC, you can put this .Bat file on your USB and use it on any computer by clicking on the button in the menu.

-reply by redisforever

   Wed Jun 25, 2008    Reply         

standby batch codeShut Down, Restart, Log Off XP Using A Batch File

just paste this into a notepad:

rundll32.Exe PowrProf.Dll, SetSuspendState Standby

saved as stadby.Bat  :)

-reply by Cxc Project

   Mon Dec 29, 2008    Reply         

I've used this command within a scheduled task script that only runs when someone is logged and only when idle for 30 min, to force sleep mode to engage.  It really helps insomina issues for users that don't logout, especially when certain user processes prevent sleep policies from working properly. 

%windir%System32rundll32.Exe powrprof.Dll,SetSuspendState 0,1,0

POW! Good night!  ZZZZZZZZZZzzzzzzzzzzz...  Users come back and think nothing happened because their PC resumes from sleep mode alomost as fast a the monitor wakes up. Make sure you enable USB keyboard & mouse wake up for an even nicer user experience.

   Fri Apr 17, 2009    Reply         

How to restart or shutdown network systems?Shut Down, Restart, Log Off XP Using A Batch File

Hi Nils,

I have tried to shutdown or restart network systems below command, shutdown -s -m hostname, but error showing is "the network path was not found. Please help me, I want restart, shutdown or logoff netowrk systems.

Regards,

Imran

   Tue Apr 28, 2009    Reply         

Remote shutdown not work. why?
Please help me.

   Thu Jun 4, 2009    Reply         

Easy and free way to make remote computer shutdownShut Down, Restart, Log Off XP Using A Batch File

Exits other tools for easy make remote computer shutdown, restart, logoff, and more. Here is one of the most easy to use and free for shutdown functions software.Free software for remote computer shutdown downloadYou can find this software tool in enc.Idraconnectivesolutions.Com web page

-reply by Jones Smith

   Tue Jun 23, 2009    Reply         

Here you can find a free :( software tool for easy make remote computer shutdown, it is easy to use an it works on Windows 2000, XP and Vista

Free download at enc.idraconnectivesolutions.com web site:

http://enc.idraconnectivesolutions.com/

   Thu Jun 25, 2009    Reply         

Quickly Post to Shut Down, Restart, Log Off XP Using A Batch File Undocumented feature for XP w/o signup Share Info about Shut Down, Restart, Log Off XP Using A Batch File Undocumented feature for XP using Facebook, Twitter etc. email your friend about Shut Down, Restart, Log Off XP Using A Batch File Undocumented feature for XP Print
Reply / Comment New Discussion / Topic Share / Bookmark E-Mail a Friend Print


Similar Topics:

Clear Pagefile On System Shutdown

While it is generally not necessary for most users, some of us want to clear the pagefile on shutdown. PAGEFILE: Windows uses this file as virtual memory / extra ram. e.g. If you are working on a highly confidential MS Word doc. When you load this document it is loaded into ram ...more

   21-Aug-2006    Reply         

Why I May Be Installing Windows Xp ...

This is a sad tale of a man and his machine that would not start again. The story continues with a sorted affair between two operating systems and a battle to win the love of this man’s heart. My problems began last weekend when I started my computer after it had been off from the prev ...more

   20-Jul-2008    Reply         

Optimizing Your Pc For... Anything Really Want your PC to fulfil it's potenial?   Optimizing Your Pc For... Anything Really Want your PC to fulfil it's potenial? (4) (0) Registry   Registry