Running Tasks from the Command Line
You can start and reset SyncFolder tasks from a command prompt, a PowerShell script, a batch file or the
Windows Task Scheduler. Use the command SyncFolder.exe (which Windows makes available as an app execution alias when SyncFolder is installed) or %LOCALAPPDATA%\Microsoft\WindowsApps\SyncFolder.exe.
Finding the Task ID
Each command needs the ID of the task. It is shown below the task name on the Task configuration page and on the Status page. Click Copy ID to clipboard to copy it.
Commands
| Command | Example | Description |
|---|---|---|
--help | SyncFolder.exe --help | Show information about the meaning and usage of all supported command line parameters. |
--exec | SyncFolder.exe --exec 16706171-e7a1-43c7-b327-167e8861d7b3 | Request the app to run the task with the given ID. You can specify multiple tasks by adding the IDs with a comma as the separator. |
--exec … --minimize | SyncFolder.exe --exec 16706171-e7a1-43c7-b327-167e8861d7b3 --minimize | Execute the indicated task(s) without opening the app window: it runs the task(s) in the background and keeps running afterwards, ready for the next command or scheduled trigger. |
--exec … --reset | SyncFolder.exe --exec 16706171-e7a1-43c7-b327-167e8861d7b3 --reset --minimize | Reset the indicated task(s) before executing them. A reset clears the task's cache files and puts it in a condition where it appears that the task has not been executed yet. |
--reset | SyncFolder.exe --reset 16706171-e7a1-43c7-b327-167e8861d7b3 | Reset the indicated task(s) without executing them. |
--maxwait | start /wait SyncFolder.exe --exec 16706171-e7a1-43c7-b327-167e8861d7b3 --minimize --maxwait 60 | Used together with start /wait, --exec and --minimize: change how many minutes the waiting command gives up after if it never hears back (default 15) — see Waiting for Completion. |
SyncFolder.exe --exec 16706171-e7a1-43c7-b327-167e8861d7b3,9f1c2d3e-4b5a-6789-0abc-def123456789
Start-Process SyncFolder.exe ` -ArgumentList "--exec 16706171-e7a1-43c7-b327-167e8861d7b3 --minimize"
Waiting for Completion
SyncFolder is a permanently running app: it starts automatically at Windows sign-in and keeps running in
the background even if you never open its window. Because of this, a command you start simply hands the
request over to that already-running instance and returns immediately, even though the task(s) are still
running. To make a script or batch file actually wait for the task(s) to finish, launch SyncFolder with
start /wait and include --exec and --minimize as command parameter:
start /wait SyncFolder.exe --exec 16706171-e7a1-43c7-b327-167e8861d7b3 --minimize
/wait only works together with --minimize. Without it, SyncFolder opens its
window to run the task(s) instead of running them in the background, and the waiting process will exit shortly
after triggering execution.
By default, a waiting command gives up after 15 minutes if it never hears back. Add --maxwait <minutes>
to change that, for example when a task is known to take longer:
start /wait SyncFolder.exe --exec 16706171-e7a1-43c7-b327-167e8861d7b3 --minimize --maxwait 60
What You See
When SyncFolder is started with a command without --minimize, it opens a page with "The app has been
invoked through a command line", the tasks to run, and their progress. If the task ID is unknown and eror
Unknown task will be reported. The Status page of each task shows Command line as the execution type.
With --minimize, none of this is shown: the task(s) run in the background without opening the app
window at all.
If one of the tasks is configured to shut down the computer afterwards, SyncFolder first asks for confirmation — see Pre- and Post-Run Actions.
Related topics: Running and Monitoring Tasks · Configuring a Task