What command line can I use to start sync of Windows 7/10 offline files?

8,044

Solution 1

Here is a procedure for starting the synchronization (tested on MS Windows 10 v. 1903) with a command:

(1) Start mobsync.exe and click the Schedule action which starts the Offline Files Sync Schedule wizard where you can create a new sync schedule which will run just once or repeatedly.

enter image description here

(2) After you save the schedule under a name, e.g. "My Offline Files Sync", a new task gets created in Windows Task Scheduler at the following location:

\Microsoft\Windows\SyncCenter\ your user SID \ task id

(3) Find that task in the Task Scheduler and from the General tab copy the task name and the task ID, i.e. the last part of the task location including the curly brackets { and }.

(4) Now you can start the synchronization with the following command:

mobsync.exe /Schedule="task name","task id"

e.g.

mobsync.exe /Schedule="My Offline Files Sync","{750FDF10-2A26-11D1-A3EA-080036587F03}"

In order to run the command in PowerShell you can use the following syntax:

& mobsync.exe --% /Schedule="My Offline Files Sync","{750FDF10-2A26-11D1-A3EA-080036587F03}"

Solution 2

I have been looking for an answer to this question for a while and apparently, there's no solution yet.

  • There's a tool named "Robocache" that lets you sync offline folders among other things, but it's not free.
  • There's also a very simple script in TechNet that allows you to sync offline folders but it has one caveat: you need to specify the path of the offline folder you want to share, so that option is discarted as well
  • There's another script in Technet named "CscSyncAll.vbs" that looks very promising but I was never able to make it work. Apparently, it was targetted for OSs older than Windows 7
  • Running mobsync.exe/offline or mobsync.exe/online does nothing

I've got to the point were I think there's no option available to programatically sync offline folders in Windows 7 or greater yet... Kind of strange, considering that Microsoft just needs to add an additional function to mobsync.exe to perform the sync from a command prompt

Share:
8,044

Related videos on Youtube

sean e
Author by

sean e

Updated on September 18, 2022

Comments

  • sean e
    sean e almost 2 years

    On Windows, I would like to start sync of offline files from the command line and after the fact be able to see in Sync Center when it either started or completed (and the result).

    mobsync.exe does not offer command line help.

    Is there some way from the command line to perform the same action as clicking on either:

    • the Sync button in Sync Center
    • the Sync button in Mobility Center
  • sean e
    sean e about 4 years
    Works from command line, but for the life of me, can't get it to work in powershell.
  • rpr
    rpr about 4 years
    I added the command that works in PowerShell (thanks to 4sysops.com/archives/use-powershell-to-execute-an-exe)