PC Review


Reply
Thread Tools Rate Thread

How to add code to shut down XP for batch file?

 
 
Eric
Guest
Posts: n/a
 
      5th Feb 2010
I get a batch file, it works fine, but I would like to add code at the end of
file to shut down XP.
Does anyone have any suggestions on how to add code to shut down XP for
batch file?
Thanks in advance for any suggestions
Eric
 
Reply With Quote
 
 
 
 
dadiOH
Guest
Posts: n/a
 
      5th Feb 2010

Eric wrote:
> I get a batch file, it works fine, but I would like to add code at
> the end of file to shut down XP.
> Does anyone have any suggestions on how to add code to shut down XP
> for batch file?
> Thanks in advance for any suggestions
> Eric


C:\WINDOWS\system32\shutdown.exe -s -t 01

--

dadiOH
____________________________

dadiOH's dandies v3.06...
....a help file of info about MP3s, recording from
LP/cassette and tips & tricks on this and that.
Get it at http://mysite.verizon.net/xico



 
Reply With Quote
 
 
 
 
John Inzer
Guest
Posts: n/a
 
      5th Feb 2010
Eric wrote:
> I get a batch file, it works fine, but I would like to add code at
> the end of file to shut down XP.
> Does anyone have any suggestions on how to add code to shut down XP
> for batch file?
> Thanks in advance for any suggestions
> Eric

======================================
I don't know anything about batch files but maybe
the following info will offer something you can use:

shutdown -s -t 0
PATH: %windir%\system32\shutdown.exe -s -t 0

restart -r -t 0
PATH: %windir%\system32\shutdown.exe -r -t 0

Here's how to put an icon on your desktop that'll
shut down your machine quickly:

1. Right-click any empty location on your desktop.

2. Click New, Shortcut.

The Create Shortcut Wizard appears.

3. In the Type the Location of the Item box, type shutdown -s -t 0

--

J. Inzer MS-MVP
Digital Media Experience

Notice
This is not tech support
I am a volunteer

Solutions that work for
me may not work for you

Proceed at your own risk


 
Reply With Quote
 
The Real Truth MVP
Guest
Posts: n/a
 
      5th Feb 2010
shutdown -t 00 the zero's indicated the time in seconds before it starts
the shutdown sequence.

--
The Real Truth http://pcbutts1-therealtruth.blogspot.com/
*WARNING* Do NOT follow any advice given by the people listed below.
They do NOT have the expertise or knowledge to fix your issue. Do not waste
your time.
David H Lipman, Malke, PA Bear, Beauregard T. Shagnasty, Leythos.




"Eric" <(E-Mail Removed)> wrote in message
news:CF450DF1-3135-4C2A-852C-(E-Mail Removed)...
>I get a batch file, it works fine, but I would like to add code at the end
>of
> file to shut down XP.
> Does anyone have any suggestions on how to add code to shut down XP for
> batch file?
> Thanks in advance for any suggestions
> Eric


 
Reply With Quote
 
EAB1977
Guest
Posts: n/a
 
      5th Feb 2010
I have a similar issue. The scheduled task for C:\Windows
\system32\shutdown.exe doesn't appear to work if the computer is
locked by me and I have the "Run if user is logged on" checkbox
checked. Any suggestions?
 
Reply With Quote
 
Pegasus [MVP]
Guest
Posts: n/a
 
      5th Feb 2010


"EAB1977" <(E-Mail Removed)> said this in news item
news:60e4dc80-e269-4ee2-8c16-(E-Mail Removed)...
> I have a similar issue. The scheduled task for C:\Windows
> \system32\shutdown.exe doesn't appear to work if the computer is
> locked by me and I have the "Run if user is logged on" checkbox
> checked. Any suggestions?


Have a look at the output from the command

shutdown /?

especially the /f switch. Very informative and essential reading when
writing batch files.

 
Reply With Quote
 
The Real Truth MVP
Guest
Posts: n/a
 
      5th Feb 2010
I don't have an XP box handy right now to try it but here are the command
line switches for the shutdown that you can try.

Usage: shutdown [/i | /l | /s | /r | /g | /a | /p | /h | /e] [/f]
[/m \\computer][/t xxx][/d [p|u:]xx:yy [/c "comment"]]

No args Display help. This is the same as typing /?.
/? Display help. This is the same as not typing any options.
/i Display the graphical user interface (GUI).
This must be the first option.
/l Log off. This cannot be used with /m or /d options.
/s Shutdown the computer.
/r Shutdown and restart the computer.
/g Shutdown and restart the computer. After the system is
rebooted, restart any registered applications.
/a Abort a system shutdown.
This can only be used during the time-out period.
/p Turn off the local computer with no time-out or warning.
Can be used with /d and /f options.
/h Hibernate the local computer.
Can be used with the /f option.
/e Document the reason for an unexpected shutdown of a computer.
/m \\computer Specify the target computer.
/t xxx Set the time-out period before shutdown to xxx seconds.
The valid range is 0-600, with a default of 30.
Using /t xxx implies the /f option.
/c "comment" Comment on the reason for the restart or shutdown.
Maximum of 512 characters allowed.
/f Force running applications to close without forewarning
users.
/f is automatically set when used in conjunction with /t xxx.
/d [p|u:]xx:yy Provide the reason for the restart or shutdown.
p indicates that the restart or shutdown is planned.
u indicates that the reason is user defined.
if neither p nor u is specified the restart or shutdown is
unplanned.
xx is the major reason number (positive integer less than
256).
yy is the minor reason number (positive integer less than
65536).

Reasons on this computer:
(E = Expected U = Unexpected P = planned, C = customer defined)
Type Major Minor Title

U 0 0 Other (Unplanned)
E 0 0 Other (Unplanned)
E P 0 0 Other (Planned)
U 0 5 Other Failure: System Unresponsive
E 1 1 Hardware: Maintenance (Unplanned)
E P 1 1 Hardware: Maintenance (Planned)
E 1 2 Hardware: Installation (Unplanned)
E P 1 2 Hardware: Installation (Planned)
P 2 3 Operating System: Upgrade (Planned)
E 2 4 Operating System: Reconfiguration (Unplanned)
E P 2 4 Operating System: Reconfiguration (Planned)
P 2 16 Operating System: Service pack (Planned)
2 17 Operating System: Hot fix (Unplanned)
P 2 17 Operating System: Hot fix (Planned)
2 18 Operating System: Security fix (Unplanned)
P 2 18 Operating System: Security fix (Planned)
E 4 1 Application: Maintenance (Unplanned)
E P 4 1 Application: Maintenance (Planned)
E P 4 2 Application: Installation (Planned)
E 4 5 Application: Unresponsive
E 4 6 Application: Unstable
U 5 15 System Failure: Stop error
E 5 19 Security issue
U 5 19 Security issue
E P 5 19 Security issue
E 5 20 Loss of network connectivity (Unplanned)
U 6 11 Power Failure: Cord Unplugged
U 6 12 Power Failure: Environment
P 7 0 Legacy API shutdown


--
The Real Truth http://pcbutts1-therealtruth.blogspot.com/
*WARNING* Do NOT follow any advice given by the people listed below.
They do NOT have the expertise or knowledge to fix your issue. Do not waste
your time.
David H Lipman, Malke, PA Bear, Beauregard T. Shagnasty, Leythos.




"EAB1977" <(E-Mail Removed)> wrote in message
news:60e4dc80-e269-4ee2-8c16-(E-Mail Removed)...
>I have a similar issue. The scheduled task for C:\Windows
> \system32\shutdown.exe doesn't appear to work if the computer is
> locked by me and I have the "Run if user is logged on" checkbox
> checked. Any suggestions?


 
Reply With Quote
 
Bert Hyman
Guest
Posts: n/a
 
      5th Feb 2010
In news:#4Yv#(E-Mail Removed) "Pegasus [MVP]"
<(E-Mail Removed)> wrote:

>
>
> "EAB1977" <(E-Mail Removed)> said this in news item
> news:60e4dc80-e269-4ee2-8c16-(E-Mail Removed).
> ..
>> I have a similar issue. The scheduled task for C:\Windows
>> \system32\shutdown.exe doesn't appear to work if the computer is
>> locked by me and I have the "Run if user is logged on" checkbox
>> checked. Any suggestions?

>
> Have a look at the output from the command
>
> shutdown /?
>
> especially the /f switch. Very informative and essential reading when
> writing batch files.


Using the /f switch is a bad idea if there will be any apps running when
you do the shutdown, since it pulls the rug out from under without
giving them an opportunity to clean up after themselves.

There's also a bug in shutdown that prevents it from working for users
who don't have "Administrator" privileges.

http://blogs.msdn.com/aaron_margosis...27/518214.aspx

which involves giving the "SeRemoteShutdownPrivilege" privilege to the
user ID.

--
Bert Hyman St. Paul, MN (E-Mail Removed)
 
Reply With Quote
 
Twayne
Guest
Posts: n/a
 
      6th Feb 2010
The phony "MVP" speaks again. Avoid its advice at all costs, including the
good posters it always maligns.


In news:4b6c4006$0$27874$(E-Mail Removed),
The Real Truth MVP <(E-Mail Removed)> typed:
> shutdown -t 00 the zero's indicated the time in seconds before it
> starts the shutdown sequence.

--
The Real Truth http://pcbutts1-therealtruth.blogspot.com/
*WARNING* Do NOT follow any advice given by the people listed below.
They do NOT have the expertise or knowledge to fix your issue. Do not waste
your time.
David H Lipman, Malke, PA Bear, Beauregard T. Shagnasty, Leythos.


>
>
> "Eric" <(E-Mail Removed)> wrote in message
> news:CF450DF1-3135-4C2A-852C-(E-Mail Removed)...
>> I get a batch file, it works fine, but I would like to add code at
>> the end of
>> file to shut down XP.
>> Does anyone have any suggestions on how to add code to shut down XP
>> for batch file?
>> Thanks in advance for any suggestions
>> Eric




--
--
Life is the only real counselor; wisdom unfiltered
through personal experience does not become a
part of the moral tissue.

 
Reply With Quote
 
Twayne
Guest
Posts: n/a
 
      6th Feb 2010

The Real Truth http://pcbutts1-therealtruth.blogspot.com/
*WARNING* Do NOT follow any advice given by the people listed below.
They do NOT have the expertise or knowledge to fix your issue. Do not waste
your time.
David H Lipman, Malke, PA Bear, Beauregard T. Shagnasty, Leythos.



In news:4b6c532c$0$2592$(E-Mail Removed),
The Real Truth MVP <(E-Mail Removed)> typed:
> I don't have an XP box handy right now to try it but here are the
> command line switches for the shutdown that you can try.
>
> Usage: shutdown [/i | /l | /s | /r | /g | /a | /p | /h | /e] [/f]
> [/m \\computer][/t xxx][/d [p|u:]xx:yy [/c "comment"]]
>
> No args Display help. This is the same as typing /?.
> /? Display help. This is the same as not typing any
> options. /i Display the graphical user interface (GUI).
> This must be the first option.
> /l Log off. This cannot be used with /m or /d options.
> /s Shutdown the computer.
> /r Shutdown and restart the computer.
> /g Shutdown and restart the computer. After the system is
> rebooted, restart any registered applications.
> /a Abort a system shutdown.
> This can only be used during the time-out period.
> /p Turn off the local computer with no time-out or warning.
> Can be used with /d and /f options.
> /h Hibernate the local computer.
> Can be used with the /f option.
> /e Document the reason for an unexpected shutdown of a
> computer. /m \\computer Specify the target computer.
> /t xxx Set the time-out period before shutdown to xxx seconds.
> The valid range is 0-600, with a default of 30.
> Using /t xxx implies the /f option.
> /c "comment" Comment on the reason for the restart or shutdown.
> Maximum of 512 characters allowed.
> /f Force running applications to close without forewarning
> users.
> /f is automatically set when used in conjunction with
> /t xxx. /d [p|u:]xx:yy Provide the reason for the restart or
> shutdown. p indicates that the restart or shutdown is
> planned. u indicates that the reason is user defined.
> if neither p nor u is specified the restart or
> shutdown is unplanned.
> xx is the major reason number (positive integer less
> than 256).
> yy is the minor reason number (positive integer less
> than 65536).
>
> Reasons on this computer:
> (E = Expected U = Unexpected P = planned, C = customer defined)
> Type Major Minor Title
>
> U 0 0 Other (Unplanned)
> E 0 0 Other (Unplanned)
> E P 0 0 Other (Planned)
> U 0 5 Other Failure: System Unresponsive
> E 1 1 Hardware: Maintenance (Unplanned)
> E P 1 1 Hardware: Maintenance (Planned)
> E 1 2 Hardware: Installation (Unplanned)
> E P 1 2 Hardware: Installation (Planned)
> P 2 3 Operating System: Upgrade (Planned)
> E 2 4 Operating System: Reconfiguration (Unplanned)
> E P 2 4 Operating System: Reconfiguration (Planned)
> P 2 16 Operating System: Service pack (Planned)
> 2 17 Operating System: Hot fix (Unplanned)
> P 2 17 Operating System: Hot fix (Planned)
> 2 18 Operating System: Security fix (Unplanned)
> P 2 18 Operating System: Security fix (Planned)
> E 4 1 Application: Maintenance (Unplanned)
> E P 4 1 Application: Maintenance (Planned)
> E P 4 2 Application: Installation (Planned)
> E 4 5 Application: Unresponsive
> E 4 6 Application: Unstable
> U 5 15 System Failure: Stop error
> E 5 19 Security issue
> U 5 19 Security issue
> E P 5 19 Security issue
> E 5 20 Loss of network connectivity (Unplanned)
> U 6 11 Power Failure: Cord Unplugged
> U 6 12 Power Failure: Environment
> P 7 0 Legacy API shutdown
>
>
>
> "EAB1977" <(E-Mail Removed)> wrote in message
> news:60e4dc80-e269-4ee2-8c16-(E-Mail Removed)...
>> I have a similar issue. The scheduled task for C:\Windows
>> \system32\shutdown.exe doesn't appear to work if the computer is
>> locked by me and I have the "Run if user is logged on" checkbox
>> checked. Any suggestions?




--
--
Life is the only real counselor; wisdom unfiltered
through personal experience does not become a
part of the moral tissue.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
xp shut down problem *nott restart, just shut down maggie Windows XP Performance 0 28th Sep 2004 01:10 AM
Making the computer shut down with "Shut down" Pandora Law Windows XP General 5 6th Aug 2004 08:16 AM
No sound when I start up my computer and when I shut it down I have to go to restart to start up the computer, then when it comes up I go down to start snd shut down mode then it will shut itself off. I have to do this every time I want to turn =?Utf-8?B?Um9zZSBFdHRhIE1hdGhld3M=?= Windows XP Performance 1 6th May 2004 12:05 AM
Shut down will not shut down The Taco Windows XP General 1 26th Mar 2004 05:01 AM
wupdater does not shut down properly on log off/shut down John C. Windows XP General 2 4th Dec 2003 02:08 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:48 AM.