![]() ![]() The end result is a PowerShell module ‘SyncToy.psm1’ providing three functions: Name I ended up writing a C# executable that only takes care of the synchronization and preview part, since I wanted to keep as much as possible of the code in PowerShell. After multiple unsuccessful attempts to work around this (also implementing the same as a C# PowerShell cmdlet). $syncEngine = New-Object SyncToy.SyncEngine($engineConfig)īut unfortunately the last line causes PowerShell to hang. ![]() While($sr.BaseStream.Position -lt $sr.BaseStream.Length) ![]() $seConfig = $bf.Deserialize($sr.BaseStream) $sr = New-Object IO.StreamReader($syncToyEngineConfigPath) $syncToyEngineConfigPath = "$env:LOCALAPPDATA\Microsoft\SyncToy\2.0\SyncToyDirPairs.bin" $syncToyEnginePath = Resolve-Path 'c:\Program Files*\SyncToy 2.1\SyncToyEngine.dll' SyncToy(圆4) needs to be run via PowerShell 圆4): Considering that I would have setup already a folder pairing called ‘Test’ using the GUI, the following code should initiate the sync operation (it’s important to use the correct version of PowerShell to test this (i.e. ![]() NET assembly that comes with the SyncToy installation. Run Microsoft SyncToy from a Console Applicationįollowing translating the suggest approach to PowerShell it seemed to be quite easy to accomplish what I wanted utilizing the SyncToyEngine.dll.Googling around for solutions I came across two related posts on : No option to specify action for overwritten files.No option to exclude files by attributes (e.g.No option to preview the sync operation.While SyncToy already comes with a commandline version out of the box, it’s lacking quite some features as compared to the graphical user interface: SyncToy has been around already since good old Windows XP times and even though there are alternative freeware applications it’s still one of my favorite tools for the job. Typical uses include sharing files, such as photos, with other computers and creating backup copies of files and folders. SyncToy 2.1 is a free application that synchronizes files and folders between locations. This post is about running Microsoft SyncToy via PowerShell. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |