Macros

Macros

FreeFileSync User Manual:
Quick Start Command Line Comparison Settings Daylight Saving Time Exclude Files Expert Settings External Applications Macros Performance RealTimeSync RTS: Run as Service Schedule Batch Jobs Synchronization Settings (S)FTP Setup Tips and Tricks Variable Drive Letters Versioning Volume Shadow Copy
Macros

All directory paths may contain macros that are expanded during synchronization. The beginnings and ends of each macro are marked by a % character. In addition to special macros handling time and date, the operating system's environment variables may also be used.
Internal Macros
MacroExampleFormat







%Date%2025-02-14[ YYYY-MM-DD ]
%Time%022842[ hhmmss ]
%TimeStamp%2025-02-14 022842[ YYYY-MM-DD hhmmss ]
%Year%2025
%Month%02[ 01–12 ]
%MonthName%Feb[ Jan–Dec ]
%Day%14[ 01–31 ]
%Hour%02[ 00–23 ]
%Min%28[ 00–59 ]
%Sec%42[ 00–59 ]
%WeekDay%5[ 1–7 ] week begin may vary locally
%WeekDayName%Fri[ Mon–Sun ]
%Week%07[ 01–52 ] calendar week
Environment Variables (Windows)
MacroExample





%AllUsersProfile%C: \ ProgramData
%AppData%C: \ Users \ Zenju \ AppData \ Roaming
%ComputerName%Zenju-PC
%LocalAppData%C: \ Users \ Zenju \ AppData \ Local
%ProgramData%C: \ ProgramData
%ProgramFiles%C: \ Program Files
%ProgramFiles(x86)%C: \ Program Files (x86)
%Public%C: \ Users \ Public
%Temp%C: \ Windows \ Temp
%UserName%Zenju
%UserProfile%C: \ Users \ Zenju
%WinDir%C: \ Windows
Special Folder Locations (Windows)
MacroExample





%csidl _ Desktop%C: \ Users \ Zenju \ Desktop
%csidl _ Documents%C: \ Users \ Zenju \ Documents
%csidl _ Pictures%C: \ Users \ Zenju \ Pictures
%csidl _ Music%C: \ Users \ Zenju \ Music
%csidl _ Videos%C: \ Users \ Zenju \ Videos
%csidl _ Downloads%C: \ Users \ Zenju \ Downloads
%csidl _ Favorites%C: \ Users \ Zenju \ Favorites
%csidl _ Resources%C: \ Windows \ Resources
%csidl _ QuickLaunch%C: \ Users \ Zenju \ AppData \ Roaming \ Microsoft \ Internet Explorer \ Quick Launch
%csidl _ StartMenu%C: \ Users \ Zenju \ AppData \ Roaming \ Microsoft \ Windows \ Start Menu
%csidl _ Programs%C: \ Users \ Zenju \ AppData \ Roaming \ Microsoft \ Windows \ Start Menu \ Programs
%csidl _ Startup%C: \ Users \ Zenju \ AppData \ Roaming \ Microsoft \ Windows \ Start Menu \ Programs \ StartUp
%csidl _ Nethood%C: \ Users \ Zenju \ AppData \ Roaming \ Microsoft \ Windows \ Network Shortcuts
%csidl _ Templates%C: \ Users \ Zenju \ AppData \ Roaming \ Microsoft \ Windows \ Templates
Note: Most of the macros above have a variant for public folders, e.g. %csidl _ Documents% has %csidl _ PublicDocuments%.
Hint: You can add flexibility to an ffs _ batch configuration file by creating new temporary environment variables in a bat or cmd file that are evaluated by FreeFileSync at runtime:
Example
The FreeFileSync batch file C: \ SyncJob.ffs _ batch contains macro %MyVar% instead of an absolute target folder and is invoked by a cmd file:
set MyVar=C: \ Target
"C: \ Program files \ FreeFileSync \ FreeFileSync.exe" C: \ SyncJob.ffs _ batch
::%MyVar% is resolved as C: \ Target during synchronization
Note
Temporary environment variables created with the set command are only valid if the synchronization is started by calling the FreeFileSync executable directly. Using start /wait would create a new program context without these temporary variables.