Function Reference


_WinAPI_ShellGetSpecialFolderPath

Retrieves the path of a special folder

#include <WinAPIShellEx.au3>
_WinAPI_ShellGetSpecialFolderPath ( $iCSIDL [, $bCreate = False] )

Parameters

$iCSIDL The CSIDL ($iCSIDL_*) that identifies the folder of interest.
$bCreate [optional] Specifies whether the folder should be created if it does not already exist, valid values:
True - The folder is created.
False - The folder is not created (Default).

Return Value

Success: The full path of a special folder.
Failure: Empty string and sets the @error flag to non-zero.

See Also

Search SHGetSpecialFolderPath in MSDN Library.

Example

#include <APIShellExConstants.au3>
#include <WinAPIShellEx.au3>

ConsoleWrite('Windows => ' & _WinAPI_ShellGetSpecialFolderPath($CSIDL_WINDOWS) & @CRLF)
ConsoleWrite('System => ' & _WinAPI_ShellGetSpecialFolderPath($CSIDL_SYSTEM) & @CRLF)
ConsoleWrite('Fonts => ' & _WinAPI_ShellGetSpecialFolderPath($CSIDL_FONTS) & @CRLF)
ConsoleWrite('Program Files => ' & _WinAPI_ShellGetSpecialFolderPath($CSIDL_PROGRAM_FILES) & @CRLF)
ConsoleWrite('Profile => ' & _WinAPI_ShellGetSpecialFolderPath($CSIDL_PROFILE) & @CRLF)
ConsoleWrite('My Documents => ' & _WinAPI_ShellGetSpecialFolderPath($CSIDL_PERSONAL) & @CRLF)
ConsoleWrite('Start Menu => ' & _WinAPI_ShellGetSpecialFolderPath($CSIDL_STARTMENU) & @CRLF)
ConsoleWrite('Favorites => ' & _WinAPI_ShellGetSpecialFolderPath($CSIDL_FAVORITES) & @CRLF)
ConsoleWrite('Desktop => ' & _WinAPI_ShellGetSpecialFolderPath($CSIDL_DESKTOP) & @CRLF)

ConsoleWrite('Invalid CSIDL => "' & _WinAPI_ShellGetSpecialFolderPath(-1) & '" @error = ' & @error & ' @extended = 0x' & Hex(@extended) & @CRLF)