Macro

Macro

Manuale dell'utente di FreeFileSync:
Avvio rapido Riga di comando Impostazioni di confronto Orario solare Escludi file Impostazioni espert Applicazioni esterne Macro Performance RealTimeSync RTS: Esegui come servizio Programma attività in serie Impostazioni di sincronizzazione (S)FTP Impostazione Consigli e trucchi Lettere di unità variabili Gestione delle versioni Copia ombra del volume
Macro

Tutti i percorsi delle directory possono contenere macro che vengono espandite durante la sincronizzazione. Le inizi e le fine di ogni macro sono indicate da un carattere % . Oltre alle macro speciali per la gestione del tempo e della data, è possibile utilizzare anche le variabili di ambiente del sistema operativo .
Macro interne
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
Nota: La maggior parte delle macro sopra riportate ha una variante per le cartelle pubbliche, ad esempio %csidl_Documents% ha %csidl_PublicDocuments%.
Suggerimento: È possibile aggiungere flessibilità a un file di configurazione ffs_batch creando nuove variabili di ambiente temporanee in un file bat o cmd che vengono valutate da FreeFileSync in fase di esecuzione:
Esempio
Il file batch di FreeFileSync C: \ SyncJob.ffs _ batch contains macro %MyVar% anziché una cartella di destinazione assoluta e viene chiamato da un file cmd:
set MyVar=C: \ Target
"C: \ Program files \ FreeFileSync \ FreeFileSync.exe" C: \ SyncJob.ffs _ batch
::%MyVar% is resolved as C: \ Target during synchronization
Nota Le variabili di ambiente temporanee create con il comando set sono valide solo se la sincronizzazione viene avviata chiamando direttamente l'eseguibile FreeFileSync. L'uso di start /wait creerebbe un nuovo contesto del programma senza queste variabili temporanee.