I would like to set up a rule in Windows 8.1 to copy a certain file to another location whenever it changes. How can I accomplish this?

  • What kind of file, what application do you access it with?
    – Tog
    May 26, 2015 at 6:43
  • @Tog Its a plain text file. I think that the answers below pretty much nails it. I just haven't gotten around to trying yet.
    – Fredrik P
    May 26, 2015 at 7:58

2 Answers 2


Create a batch file with content like this:

robocopy.exe C:\sourceDir C:\TargetDir FileName.txt /MON:1

then run the batch file whenever you log on with your user, there are several ways to do that.

The drawback here is that while this process is running in the background, it is checking for changes to your file only once every minute. So in the worst case you will not having a current backup for 59 seconds.

If you need a more "real-time" copy, you can use the Windows feature FileSystemWatcher, which you have to use from a script or program, e.g. a PowerShell script , but that is a bit more complicated than a one-line batch file.

  • Sorry for late reply, is it possible to have different names for source and destination files?
    – Fredrik P
    Jun 3, 2015 at 10:50
  • 1
    @FredrikP - Using the first method with Robocopy, No, it uses the source file name as the destination name. If you write your own solution using FileSystemWatcher, you can alter the names. Jun 3, 2015 at 10:57

You can use robocopy for this with the following parameters:

/MON:n :: MONitor source; run again when more than n changes seen
/MOT:m :: MOnitor source; run again in m minutes Time, if changed

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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