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 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 Thursday, January 16, 2014 by | Add Comment

New Comment

Your Name:
Email (for internal use only):
Comment:
 
Code above:

Categories

Recent Tweets

  • #ULTRAFASTASTIC
  • Simon Ince's Blog: Hierarchies with HierarchyID in SQL 2008 http://t.co/xSDwiF6rRS.

Valid HTML5