ShortcutDir

 Gets the path of a folder identified by a name or CSIDL value.

Syntax:

ShortcutDir(name/CSIDL [, source [, add-slash]] )

Parameters:

(s/i) name, CSIDL code or known folder id:  see list below.

(i) source (optional) flag which can under 'certain' circumstances specify the location from which the information will be retrieved. See below.

(i) add-slash (optional) if @TRUE, a backslash will be appended to the returned string if it doesn't already have a trailing backslash. The default is @FALSE.

Returns:

(s) Returns the folder path on success, or a blank string  ("") if no corresponding value was found.

 

Name or CSIDL code

Name

CSIDL code

Meaning

Description

Desktop

0

CSIDL_DESKTOP

Desktop (namespace root)

Programs

2

CSIDL_PROGRAMS

Programs folder (under Start menu in [user] profile)

Personal

5

CSIDL_PERSONAL

Personal folder ([user] profile)

Favorites

6

CSIDL_FAVORITES

Favorites folder ([user] profile)

Startup

7

CSIDL_STARTUP

Startup folder ([user] profile)

Recent

8

CSIDL_RECENT

Recent folder ([user] profile)

SendTo

9

CSIDL_SENDTO

SendTo folder ([user] profile)

Start Menu

11

CSIDL_STARTMENU

Start menu ([user] profile)

My Music

13

CSIDL_MYMUSIC

My Music ([user] profile)

My Video

14

CSIDL_MYVIDEO

My Videos  ([user] profile)

 

16

CSIDL_DESKTOPDIRECTORY

Desktop folder ([user] profile)

NetHood

19

CSIDL_NETHOOD

Network Neighborhood directory

Fonts

20

CSIDL_FONTS

Fonts virtual folder

Templates

21

CSIDL_TEMPLATES

Templates folder ([user] profile)

Common Start Menu

22

CSIDL_COMMON_STARTMENU

Start menu (All Users profile)

Common Programs

23

CSIDL_COMMON_PROGRAMS

Programs folder (under Start menu in All Users profile)

Common Startup

24

CSIDL_COMMON_STARTUP

Startup folder (All Users profile)

Common Desktop

25

CSIDL_COMMON_DESKTOPDIRECTORY

Desktop folder (All Users profile)

AppData

26

CSIDL_APPDATA

Application Data ([user] profile)

PrintHood

27

CSIDL_PRINTHOOD

PrintHood folder ([user] profile)

Local AppData

28

CSIDL_LOCAL_APPDATA

Local (non-roaming) data repository for apps

 

29

CSIDL_ALTSTARTUP

Alternate Startup ([user], DBCS)

 

30

CSIDL_COMMON_ALTSTARTUP

Alternate Startup folder (All Users profile, DBCS)

Common Favorites

31

CSIDL_COMMON_FAVORITES

Favorites folder (All Users profile)

Cache

32

CSIDL_INTERNET_CACHE

Internet Cache folder

Cookies

33

CSIDL_COOKIES

Cookies folder

History

34

CSIDL_HISTORY

History folder

Common AppData

35

CSIDL_COMMON_APPDATA

Application Data (All Users Profile)

 

36

CSIDL_WINDOWS

Windows directory or SYSROOT

 

37

CSIDL_SYSTEM

System folder

 

38

CSIDL_PROGRAM_FILES

Program Files folder

My Pictures

39

CSIDL_MYPICTURES

My Pictures folder

 

40

CSIDL_PROFILE

Users profile folder

 

41

CSIDL_SYSTEM

System folder

 

43

CSIDL_PROGRAMS_FILES_COMMON

Common files folder, e.g., C:\Program Files\Common Files

Common Templates

45

CSIDL_COMMON_TEMPLATES

Templates folder (All Users profile)

Common Documents

46

CSIDL_COMMON_DOCUMENTS

Documents folder (All Users profile)

Common Administrative Tools

47

CSIDL_COMMON_ADMINTOOLS

Admin Tools folder (All Users profile)

Administrative Tools

48

CSIDL_ADMINTOOLS

Admin Tools folder

CommonMusic

53

CSIDL_COMMON_MUSIC

My Music (All Users profile)

CommonPictures

54

CSIDL_COMMON_PICTURES

My Pictures (All Users profile)

CommonVideo

55

CSIDL_COMMON_VIDEO

My Videos (All Users profile)

 

56

CSIDL_RESOURCES

Windows resources folder

CD Burning

59

CSIDL_CDBURN_AREA

The file system directory acting as a staging area for files waiting to be written to CD. A typical path is C:\Documents and Settings\username\Local Settings\Application Data\Microsoft\CD Burning.

 

Known Folder Id

Not all known folder id's are supported on all installations of Windows Vista and newer, the braces({}) shown surrounding each id is optional, and descriptions cannot be used as substitutes for a known folder id.

Known Folder Id

Description

{724EF170-A42D-4FEF-9F26-B60E846FBA4F}

Administrative Tools

{9E52AB10-F80D-49DF-ACB8-4330F5687855}

Temporary Burn Folder

{C1BAE2D0-10DF-4334-BEDD-7AA20B227A9D}

OEM Links

{0139D44E-6AFE-49F2-8690-3DAFCAE6FFB8}

Common Programs

{A4115719-D62E-491D-AA7C-E74B8BE3B067}

Common Start Menu

{82A5EA35-D9CD-47C5-9629-E15D2F714E6E}

Common Startup

{B94237E7-57AC-4347-9151-B08C6C32D1F7}

Common Templates

{56784854-C6CB-462b-8169-88E350ACB882}

Contacts

{2B0F765D-C0E9-4171-908E-08A611B84FF6}

Cookies

{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}

Desktop

{FDD39AD0-238F-46AF-ADB4-6C85480369C7}

Documents

{374DE290-123F-4565-9164-39C4925E467B}

Downloads

{1777F761-68AD-4D8A-87BD-30B759FA33DD}

Favorites

{FD228CB7-AE11-4AE3-864C-16F3910AB8FE}

Fonts

{054FAE61-4DD8-4787-80B6-090220C4B700}

GameExplorer

{D9DC8A3B-B784-432E-A781-5A1130A75963}

History

{352481E8-33BE-4251-BA85-6007CAEDCF9D}

Temporary Internet Files

{BFB9D5E0-C6A9-404C-B2B2-AE6DB6AF4968}

Links

{F1B32785-6FBA-4FCF-9D55-7B8E7F157091}

Local Application Data

{A520A1A4-1780-4FF6-BD18-167343C5AF16}

Local Application Data Low

{2A00375E-224C-49DE-B8D1-440DF7EF3DDC}

Localized Resources Directory

{4BD8D571-6D19-48D3-BE97-422220080E43}

Music

{C5ABBF53-E17F-4121-8900-86626FC2C973}

Network Shortcuts

{2C36C0AA-5812-4B87-BFD0-4CD0DFB19B39}

Original Images

{69D2CF90-FC33-4FB7-9A0C-EBB0F0FCB43C}

Slide Shows

{33E28130-4E1E-4676-835A-98395C3BC3BB}

Pictures

{DE92C1C7-837F-4F69-A3BB-86E631204A23}

Playlists

{9274BD8D-CFD1-41C3-B35E-B13F55A758F4}

Printer Shortcuts

{5E6C858F-0E22-4760-9AFE-EA3317B67173}

User's Profile

{62AB5D82-FDC1-4DC3-A9DD-070D1D495D97}

Program Data

{905E63B6-C1BF-494E-B29C-65B732D3D21A}

Program Files

{6D809377-6AF0-444B-8957-A3773F02200E}

Program Files x64

{7C5A40EF-A0FB-4BFC-874A-C0F2E0B9FA8E}

Program Files x86

{F7F1ED05-9F6D-47A2-AAAE-29D317C6F066}

Common Program Files

{6365D5A7-0F0D-45E5-87F6-0DA56B6A4F7D}

Common Program Files x64

{DE974D24-D9C6-4D3E-BF91-F4455120B917}

Common Program Files x86

{A77F5D77-2E2B-44C3-A6A2-ABA601054A51}

Start Menu Programs

{DFDF76A2-C82A-4D63-906A-5644AC457385}

Public

{C4AA340D-F20F-4863-AFEF-F87EF2E6BA25}

Public Desktop

{ED4824AF-DCE4-45A8-81E2-FC7965083634}

Public Documents

{3D644C9B-1FB8-4f30-9B45-F670235F79C0}

Public Downloads

{DEBF2536-E1A8-4c59-B6A2-414586476AEA}

Public GameExplorer

{3214FAB5-9757-4298-BB61-92A9DEAA44FF}

Public Music

{B6EBFB86-6907-413C-9AF7-4FC2ABF07CC5}

Public Pictures

{2400183A-6185-49FB-A2D8-4A392A602BA3}

Public Videos

{52A4F021-7B75-48A9-9F6B-4B87A210BC8F}

Quick Launch

{AE50C081-EBD2-438A-8655-8A092E34987A}

Recent Items

{8AD10C31-2ADB-4296-A8F7-E4701232C972}

Resources

{3EB685DB-65F9-4CF6-A03A-E3EF65729F3D}

Roaming

{B250C668-F57D-4EE1-A63C-290EE7D1AA1F}

Sample Music

{C4900540-2379-4C75-844B-64E6FAF8716B}

Sample Pictures

{15CA69B3-30EE-49C1-ACE1-6B5EC372AFB5}

Sample Playlists

{859EAD94-2E85-48AD-A71A-0969CB56A6CD}

Sample Videos

{4C5C32FF-BB9D-43b0-B5B4-2D72E54EAAA4}

Saved Games

{7D1D3A04-DEBB-4115-95CF-2F29DA2920DA}

Saved Searches

{8983036C-27C0-404B-8F08-102D10DCFD74}

SendTo

{7B396E54-9EC5-4300-BE0A-2482EBAE1A26}

Common Gadgets

{A75D362E-50FC-4fb7-AC2C-A8BEAA314493}

Gadgets

{625B53C3-AB48-4EC1-BA1F-A1EF4146FC19}

Start Menu

{B97D20BB-F46A-4C97-BA10-5E3608430854}

Startup

{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}

System32

{D65231B0-B2F1-4857-A4CE-A8E7C6EA7D27}

System32 x86

{A63293E8-664E-48DB-A079-DF759E0509F7}

Templates

{0762D272-C50A-4BB0-A382-697DCD729B80}

Users

{18989B1D-99B5-455B-841C-AB7C74E4DDFC}

Videos

{F38BF404-1D43-42F2-9305-67DE0B28FC23}

Windows

 

For more examples of possible 'names', see the appropriate registry key.

For 'Current user' see [ HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders ].

For 'All users' see [ HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders ].

 

Source (optional)

The source parameter is only used if a name string is specified. If a CSIDL code is specified this parameter is ignored.

If the Name specified cannot be found, this flag specifies the registry location from which the information will be retrieved:

Flag

Location

0

Current user  ( default )
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders

1

All users
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders

 

Example:
;Create a shortcut to Notepad on the desktop
startdir=ShortCutDir( "Desktop", 0, 0 )
dest = StrCat( DirWindows(0), "notepad.exe" )
ShortCutMake( startdir:"\mynotepad.lnk", dest, "", "", @NORMAL, 0 )
ShortCutEdit( startdir:"\mynotepad.lnk", "", "", startdir, @NORMAL, 0 )
Exit
; Get Programs folder (under Start menu in [user] profile)
csidlcode = 2 ;CSIDL_PROGRAMS
progdir = ShortCutDir( csidlcode, 0, 0 )
Message( "Programs directory path", progdir )
Exit
See Also:

ShortcutEdit, ShortcutExtra, ShortcutInfo, ShortcutMake