# Macros

All directory paths may contain macros that are expanded during synchronization. Begin and end of each macro is marked by a % character. Besides special macros handling time and date, the operating system's environment variables can also be used.

## Internal macros

Macro | Sample value
--- | ---
%date% | 2012-12-31 format: [YYYY-MM-DD]
%time% | 123044 format: [hhmmss]
%timestamp% | 2012-12-31 123044 format: [YYYY-MM-DD hhmmss]
%year% | 2012
%month% | 12
%day% | 31
%hour% | 12
%min% | 30
%sec% | 44
%weekday% | Monday (day of the week)
%week% | 52 (calendar week)

## Environment variables (Windows)

Macro | Sample value
--- | ---
%AllUsersProfile% | C:\ProgramData
%AppData% | C:\Users\<username>\AppData\Roaming
%ComputerName% | Zenju-PC
%LocalAppData% | C:\Users\<username>\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\<username>
%WinDir% | C:\Windows

## Special folder locations (Windows)

Macro | Sample value
--- | ---
%csidl_Desktop% | C:\Users\<username>\Desktop
%csidl_Downloads% | C:\Users\<username>\Downloads
%csidl_Favorites% | C:\Users\<username>\Favorites
%csidl_MyDocuments% | C:\Users\<username>\Documents
%csidl_MyMusic% | C:\Users\<username>\Music
%csidl_MyPictures% | C:\Users\<username>\Pictures
%csidl_MyVideos% | C:\Users\<username>\Videos
%csidl_Nethood% | C:\Users\<username>\AppData\Roaming\Microsoft\Windows\Network Shortcuts
%csidl_Programs% | C:\Users\<username>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs
%csidl_Quicklaunch% | C:\Users\<username>\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch
%csidl_Resources% | C:\Windows\Resources
%csidl_StartMenu% | C:\Users\<username>\AppData\Roaming\Microsoft\Windows\Start Menu
%csidl_Startup% | C:\Users\<username>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\StartUp
%csidl_Templates% | C:\Users\<username>\AppData\Roaming\Microsoft\Windows\Templates

Note: Most macros listed here also have a variant for public folders, e.g. %csidl_MyMusic% has %csidl_PublicMusic%.

Hint: You can add a great amount of flexibility to a 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.