Hiding Microsoft SyncToyCmd for backups

The more work I do, the more paranoid I become of possibly losing it all. I’ve got a pretty elaborate hardware setup in terms of disk storage, but I was lacking a simple, functional tool to do the backups of the data on a regular basis. I looked at Microsoft SyncToy for the backups, and it seems to do everything I need/want it to, except for one – scheduling. Their help documentation tells you to use their command-line application and the built in scheduler. This seems to do the trick, but there was one snag – it shows the ugly command prompt. This simply wouldn’t do….

I fired up Visual Studio 2008 and started writing a simple little .NET app to act as a wrapper for the command-line window. At the moment, it just runs all of your folder pairs, but I’ll be expanding the command line parsing to search for specific pairs. You’ll need the .NET Framework 2.0 installed for the software to work. Simply extract the file into the SyncToy directory, follow the help instructions for setting the scheduled task, but replace the program path with the following:

[code lang=”plain”]"C:\Program Files\SyncToy\SyncToyHidden.exe" /hide /quiet[/code]

Obviously you’ll have to replace the path with the one that’s relevant to your system.

Please let me know if anyone runs into any troubles with the software.

Download SyncToyHidden

P.S. Thanks to jcarle for the help with the command line switches.

29 Comments

  1. This looks to be what i have been looking for.
    Would you be able to republish it please, when I follow the download link I get a 404.

    Many Thanks.

  2. Hi Robert,

    Sorry about the downtime. My files are stored on my Dreamhost account, and they recently moved my services to another server. I hadn’t got a chance to fix my DNS settings to the new address, but the download link should be working now.

    Let me know how things work!

    Cheers!

  3. Just wanted to thank you for this. It was a life saver! 😀

  4. Thank you for this! I’ve been looking for something like this from early XP days. Works beautifully under Windows 7.

    The only change I needed to make was remove the double quotes around the path and change it to where I have SyncToy installed.

    Now …. how about a more generic program that will allow me to run batch files silently? One where I specify the fully qualified path to the program I want to run along with the parameters, as parameters to your program?

    Something like:

    runashidden d:foldernamemybatch.cmd /parm1 /parm2 ….

  5. Perfect… that popup was getting very annoying!

    Thanks very much! 🙂

  6. I’m trying to set this up as a scheduled task on remote PC but I keep getting run time errors an I can’t figure out what is causing it. Here is the error log. I’m not sure if it will help any.

    EventType clr20r3, P1 synctoyhidden.exe, P2 1.0.0.0, P3 49678b18, P4 synctoyhidden, P5 1.0.0.0, P6 49678b18, P7 42, P8 5, P9 system.nullreferenceexception, P10 NIL.

    Bucket 602284982, bucket table 5, EventType clr20r3, P1 synctoyhidden.exe, P2 1.0.0.0, P3 49678b18, P4 synctoyhidden, P5 1.0.0.0, P6 49678b18, P7 42, P8 5, P9 system.nullreferenceexception, P10 NIL.

  7. I wanted to run just one of my SyncToy profiles, so I created a VBscript to do it. This is less risky, and more flexible, than downloading an anonymous application from the internet.

    First, open Notepad and copy the code below into a new document. Be sure to substitute the name of your SyncToy profile for the part marked [NAME OF THE PROFILE TO RUN HERE].

    Save it somewhere convenient, like in the root directory of your user profile. Give it the extension “.vbs” (Be sure that when you save it, you change the Save As Type to “All Files,” otherwise you’ll end up with a file YOURNAME.vbs.txt)

    Next, in Task Scheduler, use the Action type “Start a program.” Browse to where you saved the script. Under “Add arguments,” use //B. If you want to limit the execution to a certain number of seconds, use the arguments //B //T:1800 (replace 1800 with the actual number of seconds you want to limit it to).

    Enjoy!

    —-Begin Code
    Const HIDDEN_WINDOW = 12

    strComputer = “.”
    Set objWMIService = GetObject(“winmgmts:” _
    & “{impersonationLevel=impersonate}!” & strComputer & “rootcimv2”)
    Set objStartup = objWMIService.Get(“Win32_ProcessStartup”)

    Set objConfig = objStartup.SpawnInstance_
    objConfig.ShowWindow = HIDDEN_WINDOW
    Set objProcess = GetObject(“winmgmts:rootcimv2:Win32_Process”)

    Pth = “C:Program FilesSynctoy 2.1SynctoyCmd.exe”
    Flags = “-R “”[NAME OF THE PROFILE TO RUN HERE]”””

    errReturn = objProcess.Create(Pth & ” ” & Flags, null, objConfig, intProcessID)
    wscript.echo errReturn

    —End Code—

  8. Thanks a mill, Nick. I’m only just setting up SyncToy 2.1, but after one scheduled run I knew I had to find a way to hide the command prompt. You da man!

  9. I thing http://andresantanna.webs.com/downloads.htm is what Rich is looking for. It meant to sync between 2 networked computers with synctoy (it monitors the networked computer state and runs synctoy just when available), but the parameter can be changed to anything.

  10. Thanks for this little program, very helpful.

  11. Any luck in getting it to be able to search for specific folder pairs? The command promt annoys the … out of me, but as long as this thing runs all folder pairs, I don’t think I can use it properly, as I want to run one sync process every five minutes, and a few of the others are rather heavy, and I want to run them far less often.

  12. Chad’s suggestion is near to what I’m looking for. If I copy & Paste your code then I get errors from Windows Script Host at the quotation marks. If I chnage the code to …

    Const HIDDEN_WINDOW = 12

    strComputer = “.”
    Set objWMIService = GetObject(“winmgmts:” _
    & “{impersonationLevel=impersonate}!” & strComputer & “rootcimv2”)
    Set objStartup = objWMIService.Get(“Win32_ProcessStartup”)

    Set objConfig = objStartup.SpawnInstance_
    objConfig.ShowWindow = HIDDEN_WINDOW
    Set objProcess = GetObject(“winmgmts:rootcimv2:Win32_Process”)

    errReturn = objProcess.Create(“C:Program FilesSynctoy 2.1SynctoyCmd.exe -R”, null, objConfig, intProcessID)
    wscript.echo errReturn

    It all works. Trying to get the setup to work on a pair like “TV Shows” though, I just cannot get it to work …

    Const HIDDEN_WINDOW = 12

    strComputer = “.”
    Set objWMIService = GetObject(“winmgmts:” _
    & “{impersonationLevel=impersonate}!” & strComputer & “rootcimv2”)
    Set objStartup = objWMIService.Get(“Win32_ProcessStartup”)

    Set objConfig = objStartup.SpawnInstance_
    objConfig.ShowWindow = HIDDEN_WINDOW
    Set objProcess = GetObject(“winmgmts:rootcimv2:Win32_Process”)

    errReturn = objProcess.Create(“C:Program FilesSynctoy 2.1SynctoyCmd.exe -R TV Shows”, null, objConfig, intProcessID)
    wscript.echo errReturn

    any help appreciated
    rgds mcdirt

  13. If anyone is interested, this line works 🙂 finally …

    errReturn = objProcess.Create(“C:Program FilesSynctoy 2.1SynctoyCmd.exe -R” & “””TV Shows”””, null, objConfig, intProcessID)

  14. VBScript (somewhat counter-intuitively) uses two quotation marks in a row to denote a single quotation mark.

  15. Tks a lot, it works fine.
    As you mentioned, synctoy is a great tool but having a cmd window popup every 60 minutes is so annoying.

    The right place to put /hide /quiet setting is in the Add Arguments textbox, like this:
    /hide /quiet -R “folderpairname”

  16. Please let say thank you for this very useful tool.

    But please also me cite yourself (taken from the description of this wonderful software):

    *start*
    At the moment, it just runs all of your folder pairs, but I’ll be expanding the command line parsing to search for specific pairs.
    *end*

    Right now, the software is still processing ALL sync folder pairs. If I remember correctly, the difference between processing ALL and a named folder pair via command line is:

    -R – for all pairs
    -R “mypair” – for the pair named “mypair”

    If you are using also using this command line within your wrapper, maybe you could offer some command line “pass-through” (after /hide /quiet)? 🙂

    I know that it’s been a while since you wrote on this web blog and it’s been several years since you posted this article. But I would LOVE to see your tool working for specified pairs and if there is anything that I could do to help making it happen, then I’d be happy to get in contact to you about that.

    I’d be glad to hear from you.

    Oliver

    • Hi,
      I don’t like to be a pain in the a**e, I just hoped that somebody with access to the source code could help me with my original wish of just running a single SyncToy pair using SyncToyHidden.exe (instead of just running all pairs).

      This would be a big help to me.

      • zxian

        October 30, 2014 at 07:53

        Unfortunately, the source code for this has been lost along the way (before the days of github and before my proper backup routines).

        There are quite a few thoughts on StackOverflow on how to do this. If I remember correctly, the entire code base for SyncToyHidden was no more than 40 lines. I would love it if someone managed to recreate the functionality of my tool and properly open-sourcing the code.

        • Dear zxian,

          two years ago, I was asking about changing the way SyncToyHidden works to do only a single sync pair instead of everything in one big swing.

          You responded that you lost the source code, but that eventually you would rewrite it. I still really hope for a rewrite since the good thing is that it does not shift Focus away from any active window/application. But syncing more than one sync pair at a time can be uncomfortable if big data is involved and syncing is time-critical. Since SyncToy is offering this Feature, I still have hopes of you bringing this nice feature to the SyncToy world and users.

          Is there any chance for you to do it?

          • zxian

            December 1, 2016 at 14:45

            Sadly, I haven’t looked at this again. I don’t use SyncToy for my file synchronisation needs these days. I’m using Syncovery for my backup needs, as it supports compression, encryption, and various cloud backup providers. You can set separate schedules for different backup sets to minimize the impact on your system.

            As the saying goes, necessity is the mother of invention, and I don’t have a need to support SyncToy any longer.

  17. Hi there, your download link seems to be broken.

    Chris

    • zxian

      February 17, 2014 at 09:23

      Yes, the download link is broken. I moved hosting a while ago, and I seem to have lost the tool and the source code as well.

      I’m going to get in touch with a friend of mine to see if he might still have it available.

      Otherwise I’ll have to re-write this at some point.

  18. I have been able to source a copy of this below:

    http://theitbros.com/sync-ie9-favorites-in-ad-environment/

    • zxian

      March 7, 2014 at 17:32

      Thank you very much Tom!! I’ve grabbed a copy of the original file and updated the download link.

  19. (Apologies for commenting on a seemingly old post, though your tool is exactly what I’ve been looking for – I’m running Windows 7 32-bit, SP1)

    Hello,

    I have just put the SyncToyHidden file into practice, and it seems to hide the Command window – however, another window appears in its place. It is most likely from the SyncToyHidden.exe file, when executed by Task Scheduler, and it has a checkbox asking if I want to “Hide the Command window”, and then two buttons below with “Start” and “Stop”. None of those buttons do anything when clicked, nor does the checkbox.

    I still have to manually close the window, or at least minimise it. Do you know what may be causing this issue?

    Thank you.

    • zxian

      October 14, 2014 at 09:07

      Check the original post again – make sure you run the program with the /hide /quiet arguments. Otherwise the basic window will appear.

  20. Just brilliant,

    Thanks for sharing!

  21. Hi

    When I run the task or try to manually open SyncToyHidden I get the following message:
    “HiddenWindow has stopped working”
    “Problem signature:
    Problem Event Name: CLR20r3
    Problem Signature 01: synctoyhidden.exe
    Problem Signature 02: 1.0.0.0
    Problem Signature 03: 49678b18
    Problem Signature 04: SyncToyHidden
    Problem Signature 05: 1.0.0.0
    Problem Signature 06: 49678b18
    Problem Signature 07: 42
    Problem Signature 08: 1e
    Problem Signature 09: System.NullReferenceException
    OS Version: 6.1.7601.2.1.0.256.48”

    I’ve checked that I have .NET 2.0 on my system.
    Any suggestions?

Leave a Reply

Your email address will not be published.

*

© 2019 Zxian's Blog

Theme by Anders NorénUp ↑