How to hide SyncToy console window in windows Task Scheduler?
SyncToy is a free app from Microsoft that synchronizes files and folders between different locations. It even has a command line version (SyncToyCmd.exe), which can be used in windows Task Scheduler. Unfortunately Task Scheduler build-in “Hidden” mode didn’t hide a console window, so I composed from different sources a little vbs script. This script can be used in Task Scheduler, so no console window will show up.
SyncToy.vbs
Const HIDDEN_WINDOW = 12
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set objStartup = objWMIService.Get("Win32_ProcessStartup")
Set objConfig = objStartup.SpawnInstance_
objConfig.ShowWindow = HIDDEN_WINDOW
Set objProcess = GetObject("winmgmts:root\cimv2:Win32_Process")
errReturn = objProcess.Create("C:\Program Files\Synctoy 2.1\SynctoyCmd.exe -R" , null, objConfig, intProcessID)
Posted on January 16, 2014 by Viktar Karpach