Skip to content

Get full path of a Windows Known Folder

This action retrieves the full path of a known folder identified by the folder's KNOWNFOLDERID and stores it into a variable. See MSDN article about Known Folders

Property Name Data Type Description
KnownFolderID String Indicates the KNOWNFOLDERID constant that identifies the Known Folder. See below.
ReturnVariable VarName The variable that will store the full path. For example %MYRESULT%.

This custom action will return a blank value if an error occurs or if the package is run on Windows XP. In fact, Known Folders is a feature only available in Windows Vista and later.

KNOWNFOLDERID constants

See the corresponding MSDN article for all KNOWNFOLDERID constants

Some examples:

  • FOLDERID_LocalAppDataLow returns %USERPROFILE%\AppData\LocalLow.
  • FOLDERID_InternetCache returns %LOCALAPPDATA%\Microsoft\Windows\Temporary Internet Files.

All paths are returned without a trailing backslash. For example, "C:\Users" is returned rather than "C:\Users\".

Warning

Use the plain KNOWNFOLDERID constant name FOLDERID_XXXX, not the GUID. This name is case-sensitive: a typo error will raise a syntax error of the C compiler.

Note: these constants are defined in the knownfolders.h header file available at Compiler\Include\Win.

All available actions