Windows 10: Trying to Sync Data Between Two Windows 10 Systems w/ .bat Script

Discus and support Trying to Sync Data Between Two Windows 10 Systems w/ .bat Script in Windows 10 Network and Sharing to solve the problem; I have two systems that I use regularly that contain the same files. I'd like to automate the synching of this data between these two systems. I'd... Discussion in 'Windows 10 Network and Sharing' started by jmg999, May 4, 2021.

  1. jmg999 Win User

    Trying to Sync Data Between Two Windows 10 Systems w/ .bat Script


    I have two systems that I use regularly that contain the same files. I'd like to automate the synching of this data between these two systems. I'd originally read up on various ways to accomplish this, and I wanted to stay away from canned solutions as much as possible, so I settled on using robocopy in a .bat file and running it via Task Scheduler. However, when running the job, it would report as completed, yet no data was transferred. Further, it was pointed out to me that running this script concurrently was an inherently bad idea, since one job would perform an update, while the other would destroy its files. Thus, I'm looking for two things: 1) The correct methodology for running sync scripts between two systems w/ Task Scheduler, and 2) The correct setup of the scripts and Task Scheduler, so the job(s) complete properly. Here's all the pertinent information pertaining to my systems: I have two systems, System_A running Windows 10 Pro and System_B running Windows 10 Home, which are both on v20H2 (OS Build 19042.928). I log into both systems using my Microsoft user account, rather than a local account. I've also shared the desktops on each system, and the Microsoft user was granted full privileges on each share. The .bat files were stored on the respective desktops of each system, and they were scheduled to run every three minutes (I now understand that this was not a good idea.) System_A sync.bat: Code: cd C:\Users\username\OneDrive\Desktop robocopy C:\Users\username\OneDrive\Desktop\directory_to_sync '\\System_A\Desktop\directory_to_sync' /E /MIR /mt /z System_B sync.bat Code: cd C:\Users\username\Desktop robocopy C:\Users\username\Desktop\directory_to_sync '\\System_B\Desktop\directory_to_sync' /E /MIR /mt /z Using System_A's sync.bat as an example, this is the configuration of the Task Scheduler settings: General Tab: The Microsoft user account is the assigned user account. The task is set to run whether user is logged on or not. The task runs w/ highest privileges. I changed the configuration from Vista/Server 2008 to Windows 10. Triggers: The task begins at task creation/modification. The task will stop if it runs longer than three hours. Actions: Action: Start a program Program/script: cmd Add arguments (optional): /c sync.bat (Note: The "/c" was auto-added, after I input "sync.bat." Start in (optional): C:\Users\username\OneDrive\Desktop Conditions: The task is set to run when any network connection is available. Settings: The task is set to be run on demand. The task is set to run ASAP, when a scheduled start is missed. If the task fails, it will restart every minute and attempt to do so up to three times. The task will be stopped, if it runs longer than three hours. If the task is running, and a request doesn't stop it, it's set to force it to stop. If the task is already running, a new instance of the task is not to start. The job history reported that it completed w/ an operational code of 2, but nothing synched. Now that I understand that running concurrent jobs is not the way to go, I'd like to know the best way to sync this data, as well as what to change in my settings. Any help would be greatly appreciated. Thank you!

    :)
     
    jmg999, May 4, 2021
    #1
  2. jmg999 Win User

    Trying to Sync Data Between Two Windows 10 Systems w/ .bat Script

    I have two systems that I use regularly that contain the same files. I'd like to automate the synching of this data between these two systems. I'd originally read up on various ways to accomplish this, and I wanted to stay away from canned solutions as much as possible, so I settled on using robocopy in a .bat file and running it via Task Scheduler. However, when running the job, it would report as completed, yet no data was transferred. Further, it was pointed out to me that running this script concurrently was an inherently bad idea, since one job would perform an update, while the other would destroy its files. Thus, I'm looking for two things: 1) The correct methodology for running sync scripts between two systems w/ Task Scheduler, and 2) The correct setup of the scripts and Task Scheduler, so the job(s) complete properly.

    Here's all the pertinent information pertaining to my systems:

    I have two systems, System_A running Windows 10 Pro and System_B running Windows 10 Home, which are both on v20H2 (OS Build 19042.928). I log into both systems using my Microsoft user account, rather than a local account. I've also shared the desktops on each system, and the Microsoft user was granted full privileges on each share.

    The .bat files were stored on the respective desktops of each system, and they were scheduled to run every three minutes (I now understand that this was not a good idea.)

    System_A sync.bat:
    Code:
    System_B sync.bat
    Code:
    Using System_A's sync.bat as an example, this is the configuration of the Task Scheduler settings:

    General Tab:
    The Microsoft user account is the assigned user account.
    The task is set to run whether user is logged on or not.
    The task runs w/ highest privileges.
    I changed the configuration from Vista/Server 2008 to Windows 10.

    Triggers:
    The task begins at task creation/modification.
    The task will stop if it runs longer than three hours.

    Actions:
    Action: Start a program
    Program/script: cmd
    Add arguments (optional): /c sync.bat (Note: The "/c" was auto-added, after I input "sync.bat."
    Start in (optional): C:\Users\username\OneDrive\Desktop

    Conditions:
    The task is set to run when any network connection is available.

    Settings:
    The task is set to be run on demand.
    The task is set to run ASAP, when a scheduled start is missed.
    If the task fails, it will restart every minute and attempt to do so up to three times.
    The task will be stopped, if it runs longer than three hours.
    If the task is running, and a request doesn't stop it, it's set to force it to stop.
    If the task is already running, a new instance of the task is not to start.

    The job history reported that it completed w/ an operational code of 2, but nothing synched. Now that I understand that running concurrent jobs is not the way to go, I'd like to know the best way to sync this data, as well as what to change in my settings. Any help would be greatly appreciated. Thank you!
     
    jmg999, May 5, 2021
    #2
  3. jmg999 Win User
    Trying to Sync Data Between Two Windows 10 Systems w/ .bat Script

    Thank you for your response. I had read multiple forums and thought that I could use robocopy to mirror data, such as in this example, but maybe going w/ a remote data source is the best bet.
     
    jmg999, May 5, 2021
    #3
  4. Try3 Win User

    Trying to Sync Data Between Two Windows 10 Systems w/ .bat Script

    Trying to Sync Data Between Two Windows 10 Systems w/ .bat Script

    Yes, RoboCopy will mirror files. But that is only one way [changes in the RoboCopy Source are reflected in the Destination]. It is not syncing [a term that means two-way working - changes in both computers are copied to the other].

    Whether the source is local or remote makes no difference. There can only be a single source for RoboCopy.

    I'm not trying to tell you not to use RoboCopy but I am warning you that you can only use it if one of your computers is the master. It is not a syncing utility.
    - I use RoboCopy all the time. My main computer is the master and I use RoboCopy to update my other computers with all changes that have been made in the master.

    There are several syncing utilities around.
    - I used to use the MS utility SyncToy but I would never use it again. Whilst it would report some sync failures it would not report all sync failures so it was inherently unreliable.
    - The subject has been raised in several TenForums threads. These are merely the sync-related threads that I have kept links to
    How to Use SyncToy for Data Backups
    How do I sync files and folders in different paths?
    Sync Windows 10 files on 2 identical Pcs
    Best way to Sync from source to multiple locations?
    How do I backup files with Robocopy instead of Synctoy
    Syncing Thumb Drive


    Denis
     
    Try3, May 5, 2021
    #4
Thema:

Trying to Sync Data Between Two Windows 10 Systems w/ .bat Script

Loading...
  1. Trying to Sync Data Between Two Windows 10 Systems w/ .bat Script - Similar Threads - Trying Sync Data

  2. Microsoft account syncing between two laptops

    in Windows 10 Software and Apps
    Microsoft account syncing between two laptops: Hello,I have two laptops with the same Microsoft account, and one crashed before I could clear out some private documents -- it can't be accessed or even turned on at all. If I delete documents on the working laptop -- the two are supposed to be in sync -- will they also be...
  3. Microsoft account syncing between two laptops

    in Windows 10 Gaming
    Microsoft account syncing between two laptops: Hello,I have two laptops with the same Microsoft account, and one crashed before I could clear out some private documents -- it can't be accessed or even turned on at all. If I delete documents on the working laptop -- the two are supposed to be in sync -- will they also be...
  4. USING ONEDRIVE TO SYNC BETWEEN TWO LAPTOPS

    in Windows 10 Network and Sharing
    USING ONEDRIVE TO SYNC BETWEEN TWO LAPTOPS: I use several Word and Excel documents on my laptop at work and continually revise/update them throughout the day. I recently purchased a new laptop for home and want to be able to work on these documents both at work and at home. Am trying to learn OneDrive in order to...
  5. How to sync a folder between two laptops?

    in Windows 10 Ask Insider
    How to sync a folder between two laptops?: Hi everyone, I have two laptops, Laptop A and Laptop B. I use Laptop A for working from home and Laptop B is mainly for Netflix as it also works as a tablet. Is it possible to sync my work from Laptop A to Laptop B? OneDrive doesn't work on Laptop A so I am unable to use...
  6. Windows 10 Sync between two computers

    in Windows 10 Customization
    Windows 10 Sync between two computers: Hello! When you go to Settings --> Account --> Sync Your Settings, what EXACTLY gets synced between two computers for example? Does this work like Windows 7 Transfer Wizard used to which I loved and never had a problem with? Are programs synced over to the new computer? What...
  7. Clipboards not syncing between my two computers.

    in Windows 10 Customization
    Clipboards not syncing between my two computers.: I upgraded both mine and my wife's computer, which sits next to mine, to Version 1903 today. I followed the directions exactly to be able to copy from one computer and then go to the clipboard history on the other computer and then paste onto it. However when I copy...
  8. Share Data Between the two Computers

    in Windows 10 Network and Sharing
    Share Data Between the two Computers: I have two computers on a private network. I need to share data between the two computers \ I have two computers on a private network. I need to share data between them. Some times I can see both computers and sometimes I cant. [Original Title: Roy]...
  9. Backup and sync files between two computers

    in Windows 10 Network and Sharing
    Backup and sync files between two computers: Hi, Is there a recommended solution for setting up an automated back-up system between a Windows 10 Desktop and a Windows 10 Laptop? I have both machines connected on the home Wifi network and I hope to be able to work on files on the laptop that would have changes...
  10. Transferring data between two computers.

    in Windows 10 Support
    Transferring data between two computers.: Hello, I have recently bought a new laptop and I want to transfer all the data from my Personal Computer to laptop. Which option should I use, disk image or clone creator? Is transferring all the data in order to make my laptop the same as my computer even possible? Both...