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 NameData TypeDescription
KnownFolderIDStringIndicates the KNOWNFOLDERID constant that identifies the Known Folder. See below.
ReturnVariableVarNameThe 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.


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\”.

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

© G.D.G. Software 2018. All rights reserved.