SyncToy from the command line RRS feed

  • General discussion

  • SyncToy 2.1 works from the command line just fine.  However, the annoying flash of the GUI should be eliminiated.
    Further, there should be a way to list the existing folder pairs from the command line. For those interested here is a simple
    powershell script which will create a folder pair using the synctoy.exe -d... command line interface.

    # Location of synctoy on my system

    # read string and verify it is a readable directory.
    function readdir{
      param($prompt="Directory Name")
      while($true) {
        $dir=read-host -prompt "$prompt"
        if(test-path -type container $dir) {
        "<" + $dir + "> NOT A DIRECTORY"
      return $dir

    # Enter 4 parameters needed by SyncToy to create a Folder Pair
    $l=readdir "Enter left directory"
    $r=readdir "Enter right directory"
    $nm=read-host -p "Enter Name of directory pair"
    $op=read-host -p "Enter Operation:
    1 - Synchronize
    2 - Echo
    3 - Contribute"

    # convert one character response to what SyncToy needs.
      1 { $op="synchronize"}
      2 { $op="echo"}
      3 { $op="contribute"}

    # Run SyncToy
    &($stx)  "-d(left=$l,right=$r,name=$nm,operation=$op)"


    I don't full appreciate the subtelies when PS requires the &() do execute a program with arguments.
    Nevertheless, the above PS script plus two simple aliases:

    set-alias st c:\pgms\synctoy\synctoy.exe
    set-alias stc C:\pgms\SyncToy\SyncToyCmd.exe

    make Synctoy much more accessible. One can define a folder
    pair, synchronize it and then remove the folder pair in a vanishlingly small amount of time.

    I just want to manage the synchronization process entirely from the command line. It is much
    faster and more efficient. Otherwise, these two work together quite well.

    Monday, December 21, 2009 4:14 PM