use Win32 qw(CSIDL_APPDATA);
print Win32::GetFolderPath(CSIDL_APPDATA);
This is a question the most Win32 programmers ask at some point, so it is worth posting some comprehensive info from MSDN
Whenever you access any of the special folders in the following list, your application should use the Win32 APIs to dynamically obtain the proper language-specific folder names. The preferred way to do this is using the SHGetFolderPath API with the appropriate CSIDL constant. This function behaves consistently across Windows 95, Windows 98, Windows NT 4.0, and Windows 2000.
This API is redistributable via the SHFOLDER.DLL. SHFOLDER.DLL is installed by the Windows Installer redistributable. Software vendors are encouraged to redistribute this component as much as possible to enable this support on Windows operating systems prior to Windows 2000. Windows 2000 includes this DLL as a protected system file and, as such, this DLL cannot be replaced on Windows 2000 or greater.
To help ensure your application can run on Windows 9x, Windows NT 4 as well as Windows 2000, always link to the SHGetFolderPath implementation in SHFOLDER.DLL. Windows 2000 natively implements SHGetFolderPath in SHELL32.DLL, but other versions of Windows do not include SHGetFolderPath in SHELL32.DLL.
Standard Folder | CSIDL Constant Name |
Alternate Startup ([user], DBCS) | CSIDL_ALTSTARTUP |
Alternate Startup folder (All Users profile, DBCS) | CSIDL_COMMON_ALTSTARTUP |
Application Data ([user] profile) | CSIDL_APPDATA |
Application Data (All Users Profile) | CSIDL_COMMON_APPDATA |
Control Panel virtual folder | CSIDL_CONTROLS |
Cookies folder | CSIDL_COOKIES |
Desktop (namespace root) | CSIDL_DESKTOP |
Desktop folder ([user] profile) | CSIDL_DESKTOPDIRECTORY |
Desktop folder (All Users profile) | CSIDL_COMMON_DESKTOPDIRECTORY |
Favorites folder ([user] profile) | CSIDL_FAVORITES |
Favorites folder (All Users profile) | CSIDL_COMMON_FAVORITES |
Fonts virtual folder | CSIDL_FONTS |
History folder | CSIDL_HISTORY |
Internet Cache folder | CSIDL_INTERNET_CACHE |
Internet virtual folder | CSIDL_INTERNET |
Local (non-roaming) data repository for apps | CSIDL_LOCAL_APPDATA |
My Computer virtual folder | CSIDL_DRIVES |
My Pictures folder | CSIDL_MYPICTURES |
Network Neighborhood directory | CSIDL_NETHOOD |
Network Neighborhood root | CSIDL_NETWORK |
Personal folder ([user] profile) | CSIDL_PERSONAL |
Printers virtual folder | CSIDL_PRINTERS |
PrintHood folder ([user] profile) | CSIDL_PRINTHOOD |
Program Files folder | CSIDL_PROGRAM_FILES |
Program Files folder for x86 apps on Alpha systems | CSIDL_PROGRAM_FILESX86 |
Programs folder (under Start menu in [user] profile) | CSIDL_PROGRAMS |
Programs folder (under Start menu in All Users profile) | CSIDL_COMMON_PROGRAMS |
Recent folder ([user] profile) | CSIDL_RECENT |
Recycle Bin folder | CSIDL_BITBUCKET |
SendTo folder ([user] profile) | CSIDL_SENDTO |
Start menu ([user] profile) | CSIDL_STARTMENU |
Start menu (All Users profile) | CSIDL_COMMON_STARTMENU |
Startup folder ([user] profile) | CSIDL_STARTUP |
Startup folder (All Users profile) | CSIDL_COMMON_STARTUP |
System folder | CSIDL_SYSTEM |
System folder for x86 applications on Alpha systems | CSIDL_SYSTEMx86 |
Templates folder ([user] profile) | CSIDL_TEMPLATES |
User’s profile folder | CSIDL_PROFILE |
Windows directory or SYSROOT | CSIDL_WINDOWS |
|