uses System.IOUtils; procedure TForm1.FormCreate(Sender: TObject);varS: string;begin{ 三种方法结果一致: C:UserswyAppDataRoaming }S := GetHomePath; // SysUtils, 能跨平台且简单, 在 Windows 下使用 SHGetFolderPath 完成S := TPath.GetHomePath; // System.IOUtilsS := GetEnvironmentVariable("APPDATA"); // 以前一直用这个end;