Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

The /MON:1 option works just great and run directory scan if only changes happened. This is something that is not possible to do if robocpy is ran from windows scheduler each 10 min.

Is there a way to run the

robocopy  \\\D$\RoboCopyTest \\\D$\RoboCopyTest /FFT /Z /ETA /E /XA:H /R:0 /W:1 /XO /NP /NDL /NFL /MON:1

command automatically when windows starts, and if the command was stopped for some reason - restart it and notify to windows event log that the command was stopped for some reason. The robocpy command with /MON:n option has infinite loop to run itself only if files had N changes.

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

You may be better off creating a Windows Service for this instead of running it from the task Scheduler. The Service framework is designed around this start-once-run-forever kind of program and has hooks for eventing in case of unknown stoppage.

Creating a user-defined service is pretty easy. Though the article is designed for Windows 2000, it still works for 2008. The 'sc' command is used to create the service.

sc create "Robocopy-Service" binPath= "c:\tools\robocopy.exe" start= auto

Change the values based on how you want the service to run. Once it's there, you can go into the Service Manager and modify the service for how to handle sudden stopping. It'll always record and event ("Service xyz stopped unexpectedly") but you can tell it how to restart the service, or run a script if you need to send emails about it.

share|improve this answer
But how do you pass the parameters to robocopy? –  simon Dec 20 '12 at 10:10
I'm also having troubles passing in parameters. –  Klee Apr 6 at 23:33
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.