views:

1451

answers:

1

Hello,

I am trying to write a system restart Task for Windows Vista. I'm a web developer by trade so I'm a little out of my element here. I have got into my OS and discovered Task Scheduler.

So far I've been able to set up some various tasks to run small WPF programs by calling the *.exe files. What I really need to do is set up a system restart at a specific time. 1 a.m. for example.

Is there a way to write a simple shell script that will force restart Windows Vista as a scheduled task?

My concern is that Vista typically asks to shut down programs when you hit restart, so I would want to make sure that it really is automatic requiring zero user interaction.

Any help, or links to examples would be greatly appreciated.

System: Windows Vista 32bit

Cheers, Ryan

Answer: Copy and Paste the code in the selected answer to a text file.

shutdown -r -f -t 01

Save the file as a *.bat file. You can then select it in the Actions Tab of the Task Scheduler. Works like a charm.

+4  A: 

Execute

shutdown -r -f -t 01

will restart windows in 1 second.

Burkhard
How would I contain these commands in a text file or .exe that would execute via the Task Scheduler?
discorax
Well, exactly like you found out by yourself :-)
Burkhard