Run a scheduled task at shutdown ?

Associate
Joined
30 May 2005
Posts
1,533
Location
Greater Manchester
I have an idea where I use Windows Sync Toy to copy the documents folder of one machine to another for backup purposes.

I want to run this as a scheduled task, but there only seems to be the option of Daily
Weekly
Monthly
Once
When My Computer Starts
When I log on.

Well I thought it would be best to sync the folder on a shutdown. Just seems more logical. You do some work -shut the machine down - it makes a backup and then shuts down the PC.

Does anyone know a way to do this ?
 
Kerplunk said:
You create a BAT file. Then schedule it using what you said, Scheduled Tasks.

:)
How do you make it run at shutdown though? He's already said there isn't a At Shutdown option that he can see under Scheduled Tasks.
 
Kerplunk said:
IIRC you hae to enter "shutdown -f -s" in the BAT file.
Oh that easy? Might have to try that. So does that command go at the end of the bat file? So I'd have some files copied from A to B then 'shutdown -f -s'?

What do the -f and -s stand for?
 
-f stands for force, the -s escapes me.

I was just testing it out a sec ago and i accidently, ran the BAT file, lol. :p Yes it shut down.
 
Kerplunk said:
Incidentally, I was :D
Noob. :D
"Where'd you go?"
"Er, I shutdown my PC"
"Er, why'd you do that? I was talking to you!"
"Well you see I was messing around with the shutdown commands"
"LOL. Noob"

Like that by any chance? :p
 
This can be done via group policy if you're running Xp Pro (Not Home)

Start -> Run -> gpedit.msc

You've now got two options - you can configure it to run a script at user logoff (1) OR at machine shut down (2)

(1) User Configuration -> Windows Settings -> Scripts (Logon/Logoff) & double click Logoff in the right-hand pane

(2) Computer Configuration -> Windows Settings -> Scripts (Startup/Shutdown) & double click Shutdown in the right-hand pane

Using either of these, you can set windows to run a batch file (.BAT or .CMD file) that you've written to synchronise your files manually (or prompted SyncToy to do it).

One warning - Be VERY careful with Group Policy - it's VERY powerful and you can lock yourself out of Windows permanently (well, everything bar a reinstall)!!
 
Back
Top Bottom