function GetShellFolders(strDir: string): string; const regPath = '\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders'; var Reg: TRegistry; strFolders: string; begin Reg := TRegistry.Create; try Reg.RootKey := HKEY_CURRENT_USER; if Reg.OpenKey(regPath, false) then begin strFolders := Reg.ReadString(strDir); end; finally Reg.Free; end; result := strFolders; end; {獲取桌面} function GetDeskeptPath: string; begin Result := GetShellFolders('Desktop'); //是取得桌面文件夾的路徑 end; {獲取個人文檔} function GetMyDoumentpath: string; begin Result := GetShellFolders('Personal'); //個人文檔 end;UsesWindows,Registry;