函数参考


_WinAPI_ShellGetSpecialFolderPath

获取特殊文件夹的路径

#Include <WinAPIEx.au3>
_WinAPI_ShellGetSpecialFolderPath ( $CSIDL [, $fCreate] )

参数

$CSIDL 标识所需文件夹的CSIDL.($CSIDL_*)可为下列值:
$CSIDL_ADMINTOOLS
$CSIDL_ALTSTARTUP
$CSIDL_APPDATA
$CSIDL_BITBUCKET
$CSIDL_CDBURN_AREA
$CSIDL_COMMON_ADMINTOOLS
$CSIDL_COMMON_ALTSTARTUP
$CSIDL_COMMON_APPDATA
$CSIDL_COMMON_DESKTOPDIRECTORY
$CSIDL_COMMON_DOCUMENTS
$CSIDL_COMMON_FAVORITES
$CSIDL_COMMON_MUSIC
$CSIDL_COMMON_PICTURES
$CSIDL_COMMON_PROGRAMS
$CSIDL_COMMON_STARTMENU
$CSIDL_COMMON_STARTUP
$CSIDL_COMMON_TEMPLATES
$CSIDL_COMMON_VIDEO
$CSIDL_COMPUTERSNEARME
$CSIDL_CONNECTIONS
$CSIDL_CONTROLS
$CSIDL_COOKIES
$CSIDL_DESKTOP
$CSIDL_DESKTOPDIRECTORY
$CSIDL_DRIVES
$CSIDL_FAVORITES
$CSIDL_FONTS
$CSIDL_INTERNET_CACHE
$CSIDL_HISTORY
$CSIDL_LOCAL_APPDATA
$CSIDL_MYMUSIC
$CSIDL_MYPICTURES
$CSIDL_MYVIDEO
$CSIDL_NETHOOD
$CSIDL_PERSONAL
$CSIDL_PRINTERS
$CSIDL_PRINTHOOD
$CSIDL_PROFILE
$CSIDL_PROGRAM_FILES
$CSIDL_PROGRAM_FILES_COMMON
$CSIDL_PROGRAM_FILES_COMMONX86
$CSIDL_PROGRAM_FILESX86
$CSIDL_PROGRAMS
$CSIDL_RECENT
$CSIDL_SENDTO
$CSIDL_STARTMENU
$CSIDL_STARTUP
$CSIDL_SYSTEM
$CSIDL_SYSTEMX86
$CSIDL_TEMPLATES
$CSIDL_WINDOWS
$fCreate [可选参数] 指定是否建立不存在的文件夹, 有效值为:
1 - 创建文件夹.
0 - 不创建文件夹. (默认)

返回值

成功: 返回特殊文件夹的完整路径.
失败: 返回空字符串,设置@error标志为非 0 值.

注意/说明

None

相关

详情参考

在MSDN中搜索


示例/演示


#Include <APIConstants.au3>
#Include <WinAPIEx.au3>

Opt('MustDeclareVars', 1)

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