$shpath function

$shpath(csidl)
$shpath(knownfolderid)

The $shpath function returns the shell path represented by either the CSIDL csidl (a unique identifier used by the Windows shell for special folder locations) or by the KNOWNFOLDERID knownfolderid (a new style symbolic folder GUID introduced with Windows Vista). If called without parameters, the result is the Desktop path; if csidl or knownfolderid refers to a non-existing folder, the result is an empty string.

Notes

Parameters

All parameters may contain symbolic references; these are resolved before the function is applied. See Examples below.

csidl
CSIDL of the desired folder. The CSIDL values are defined by Windows; note that not all Windows versions support all CSIDL values. You can use either decimal or hexadecimal values for the csidl parameter, but you can not use the symbolic name. For a list of CSIDL values, see the topic CSIDL values.
knownfolderid
KNOWNFOLDERID of the desired folder. This must be a GUID in the format {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}; the actual values are defined by Windows. Note that folder path lookup by KNOWNFOLDERID was introduced in Windows Vista; older versions of Windows do not support this format and will always return an empty path. For a list of KNOWNFOLDERIDs, see the topic KNOWNFOLDERID values.

Examples

Here are some usage examples for this function:

<$shpath(56)>
Returns C:\Windows\resources on a Windows system that supports CSIDL_RESOURCES; returns an empty path on older systems.
<$shpath(0x38)>
Same as previous, using hexadecimal notation.
<$shpath({FDD39AD0-238F-46AF-ADB4-6C85480369C7})>
On Windows Vista and later, returns the path to the user's Documents folder using the FOLDERID_Documents GUID value. On earlier versions of Windows, returns an empty path.