Sign in with
Sign up | Sign in
Your question

Batch shutdown

Last response: in Windows 7
Share
March 17, 2011 2:26:58 PM

hello...i hava batch file that shutdowns my windows 7 pc at certain time everyday. (night). how can i get this to run daily. currently it runs on the day i "excute the batch file". for certain reason, i don't want to use the "Schedule Task" to do this. current batch file below...

@echo off
at 21:28 shutdown -s -t 180 -c "Your PC will shutdown in 3 mins. Pls save all open files!"

can someone please help

More about : batch shutdown

a b $ Windows 7
March 17, 2011 2:29:55 PM

If you don't want to use the Task Scheduler, have a look at the "at" command. Obviously, you'll need to be an Administrator to use it.
a c 209 $ Windows 7
March 17, 2011 2:49:54 PM

"at" is just a command-line interface to Task Scheduler, IIRC.

Try using "at /?" to get a list of command line options. It sounds to me like you want to use the "/every: date[,...]" option to run it every day.
Related resources
March 17, 2011 2:50:22 PM

thanks...I want to use the "at" command not just the GUI interface of the "Task Scheduler"..

will the following work...
at 10:55 /every:M,T,W,Th,F,S,Su shutdown -s -t 180 -c "Your PC will shutdown in 3 mins. Pls save all open files!"
a b $ Windows 7
March 17, 2011 3:01:05 PM

You need use the full pathname for the command (e.g. C:\Windows\System32\shutdown.exe). Otherwise that command should work. Do "at" with no paramaters after you've entered it - this will list the scheduled commands and let you check that it is what you expected.
March 18, 2011 3:59:26 PM

the following code worked well yesterday (for the first time)

@echo off
at 10:55 /every:D aily shutdown -s -t 180 -c "Your PC will shutdown in 3 mins. Pls save all open files!"

but today it didn;t not run and gave the following error...any idea why?

...errer..."task did not run due to one of the contraints in the task defination. (0x80041324)"
a c 209 $ Windows 7
March 18, 2011 4:34:04 PM

I think you may have to actually look at Task Scheduler and see what the "AT" command has set up for you. There's a wide variety of options - for example it can be configured to only run if the user is signed on at the time. Through the Task Scheduler interface you can control all of those options.
a b $ Windows 7
March 18, 2011 4:42:27 PM

Are you running that as a batch file? The error means that the task is already running and you are trying to run it again. type "at" in a command prompt to see if you have scheduled it more than one.

You just type the "at" command in a command prompt and it is scheduled forever after (until you cancel it). Don't put it in a batch file or it will keep adding tasks. You might also need to use the "/interactive" switch after "at" to get the message to display.
a c 209 $ Windows 7
March 18, 2011 7:25:08 PM

Ijack said:
Don't put it in a batch file or it will keep adding tasks. You might also need to use the "/interactive" switch after "at" to get the message to display.
Ah yes, that might well be what he's done. The "at" only needs to be executed once, after that the scheduler will run the command automatically at the indicated time (which is the whole point of scheduling it....). If you run the "at" a second time then you'll get two copies of the shutdown command running, and the second one will probably fail because the first one is in the middle of shutting the system down.
a b $ Windows 7
March 18, 2011 9:07:03 PM

I'm intrigued as to why the OP doesn't want to use the Task Scheduler. Makes life so much easier in practice.
a c 209 $ Windows 7
March 18, 2011 10:37:51 PM

To be fair, Task Scheduler is a little daunting because of all the options - you have to add Triggers, Actions, etc. etc. But I quite like it - so much more capable than the earlier versions that Windows started with.
December 12, 2012 9:16:31 PM

arke2den said:
hello...i hava batch file that shutdowns my windows 7 pc at certain time everyday. (night). how can i get this to run daily. currently it runs on the day i "excute the batch file". for certain reason, i don't want to use the "Schedule Task" to do this. current batch file below...

@echo off
at 21:28 shutdown -s -t 180 -c "Your PC will shutdown in 3 mins. Pls save all open files!"

can someone please help

I( don't like windows scheduler so I too had to find a solution. I came across a freeware application named clocx from clocx.net . It serves 2 purposes. It nicely replaces the standard Windows clock gadget and it also has multi alarm facility to do what ever you want at predefined times on predefined days/dates. Works on XP too.

Works for me.
!