宏
宏
《FreeFileSync 用户手册》快速入门 命令行 比较设置 夏令时 排除文件 专家设置 外部应用程序 宏 性能 实时同步 实时同步:作为服务运行 计划批处理作业 同步设置 (S)FTP设置 提示与技巧 可变驱动器号 版本控制 卷影复制
所有目录路径可能包含在同步期间会展开的宏。每个宏的开头和结尾都由一个**% 字符标记。除了处理时间和日期的特殊宏之外,还可以使用 操作系统的环境变量**。
注意 :上面的大多数宏都有适用于公用文件夹的变体,例如 %csidl_Documents% 有 %csidl_PublicDocuments%。提示 :你可以通过在批处理文件或命令提示符文件中创建新的临时环境变量来为ffs_batch配置文件添加灵活性,这些变量将在运行时由FreeFileSync进行计算:FreeFileSync批处理文件 C: \ SyncJob.ffs _ batch contains macro %MyVar% 而不是绝对目标文件夹,并且由一个cmd文件调用:set MyVar=C: \ Target
"C: \ Program files \ FreeFileSync \ FreeFileSync.exe" C: \ SyncJob.ffs _ batch::%MyVar% is resolved as C: \ Target during synchronization注意 使用
宏
所有目录路径可能包含在同步期间会展开的宏。每个宏的开头和结尾都由一个**% 字符标记。除了处理时间和日期的特殊宏之外,还可以使用 操作系统的环境变量**。
内部宏
Macro | Example | Format | ||||
%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)
Macro | Example | |||
%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)
Macro | Example | |||
%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 |
示例
"C: \ Program files \ FreeFileSync \ FreeFileSync.exe" C: \ SyncJob.ffs _ batch::%MyVar% is resolved as C: \ Target during synchronization注意 使用
set
命令创建的临时环境变量仅在通过直接调用 FreeFileSync 可执行文件启动同步时才有效。使用 start /wait
将创建一个没有这些临时变量的新程序上下文。