1.

Solve : Two questions about Auto Shutdown code?

Answer»

Hi, I has questions about the auto shutdown thing in command prompt, so if you'd please be kind enough to answer em, that'd be grand

Alright.

1. I tried to shutdown my computer at a certain time by creating a shortcut with the code Shutdown -s -t 00 -f, and then scheduled it to run at 11. Well, come 1, it was still on...and when I opened the shortcut it shutdown right, but when you run it from the scheduler it apparently opens a ms-dos box then closes it at the speed of light, anyone know why?

2. When i tried messing around with different forms of the shutdown code, like shutdown -t 60 or shutdown -c "Installing Effres.exe", it didnt work that way......it just shutdown completely with no changes as to how it shuts down.........What'd I do wrong here?

Oh and I have Windows XP Service 2 by the way. Thanks in advance!When I to replicate your code and double-click it, it just showed the code (i.e. it didn't execute).

I think this is because you can't use shutdown in a batch file (correct me if I'm wrong, more experienced people). I used the same code directly into Command Prompt, it worked.

But you said that it worked when you double-clicked it, only not in schedule? When I schedule it, it does the same thing as double-clicking = showing the code, not executing.For a batch file, use this:

Code: [Select]shutdown -s -f -t "00"
That works for me.Quote from: Carbon Dudeoxide on April 20, 2007, 07:41:12 PM

For a batch file, use this:

Code: [Select]shutdown -s -f -t "00"
That works for me.

It doesn't work when you put it in a batch file and try to OPEN it. It just repeatadly displays the code.Quote from: Dark Blade on April 20, 2007, 07:55:48 PM
It doesn't work when you put it in a batch file and try to open it. It just repeatadly displays the code.

What do you mean by "displays the code"? Do you mean loading it into notepad? Are you double clicking the batch file? How do you normally run batch FILES?

This is what I use to shut down my computer. I have been using it every day for about 2 years in a batch file. Works every time. No quotes around the time parameter either. Actually I always use the .cmd extension rather than .bat these days to get the advantages of Windows XP's cmd.exe. i wonder if this makes a difference?

Code: [Select]shutdown -s -t 01 -c Code: [Select]shutdown -s -t 01 -c
You don't actually need to have -c (that displays a MESSAGE). But it might work differently in .cmd.

Nope. I tried that, it does that same as .bat.

Quote
What do you mean by "displays the code"? Do you mean loading it into notepad? Are you double clicking the batch file? How do you normally run batch files?
I save the code as a batch file, and when I open it (double click), displays:
Code: [Select]shutdown -s -t 30
shutdown -s -t 30
shutdown -s -t 30
shutdown -s -t 30
shutdown -s -t 30
shutdown -s -t 30

And just says that a lot.

Just to make sure, are you typing the code in notepad, saving it to the desktop as name.bat and double clicking 'name.bat' ?Quote from: Dark Blade on April 21, 2007, 05:55:59 PM
You don't actually need to have -c (that displays a message). But it might work differently in .cmd.

I accidentally cut off the rest of the line. It should read

shutdown -s -t 01 -c "System closing down!"

Quote
I accidentally cut off the rest of the line. It should read

shutdown -s -t 01 -c "System closing down!"
OK.

Quote
Just to make sure, are you typing the code in notepad, saving it to the desktop as name.bat and double clicking 'name.bat' ?

Yep. I do that, and it does exactly what I said before (even if I save it as .cmd, not .bat).A long shot...

http://www.aumha.org/win5/a/shtdwnxp.php

In fact that page is full of shutdown problem tips.

It seems a shutdown batch file can hang sometimes for example as here, but there are other causes. Google for "shutdown batch hangs"

Quote
USING SHUTDOWN SCRIPTS & 802.1x AUTHENTICATION PROTOCOL. This combination can cause Win XP to take in excess of 10 minutes to shutdown normally. (IEEE 802.1x is an authentication standard for both wireless networks and wired Ethernet networks.) Here’s how the dominoes fall: The 802.1x authentication protocol stops after the user logs off. Shutdown scripts run after the user logs off. If the script is on a network share and the connection is no longer available (since authentication has terminated), the script can’t run. The default time-out for shutdown scripts is 10 minutes. So the computer sits there 10 minutes before continuing with its shutdown.

Anyone know how to give said batch file a trigger, such as when a specified file is accessed? All,

Try using the following to shutdown Windows XP from an MS-DOS batch file:-

start shutdown.exe -s -f -t 0

Works for me.

Hope that helps,
James


Discussion

No Comment Found