File paths

Special folders

With all QM file functions (run, cop, ren, del, FileExists, str.searchpath, str.getfile and other, also in user-defined functions) and in menus/toolbars, a file path can begin with a special folder string. There are several ways to specify a special folder.


1. QM-defined special folder string enclosed in $.

{CSIDL_ADMINTOOLS, "Administrative Tools"},
{CSIDL_COOKIES, "Cookies"},
{CSIDL_PERSONAL, "Documents"},
{CSIDL_PERSONAL, "My Documents"}, //alias
{CSIDL_PERSONAL, "Personal"}, //alias
{CSIDL_FAVORITES, "Favorites"},
{CSIDL_FONTS, "Fonts"},
{CSIDL_HISTORY, "History"},
//{?, "Local Settings"}, //no csidl. Dropped in QM 2.3.0.
{CSIDL_MYMUSIC, "My Music"},
{CSIDL_MYPICTURES, "My Pictures"},
{CSIDL_MYVIDEO, "My Video"},
//{CSIDL_PHOTOALBUMS, "Photoalbums"}, //Vista
//{CSIDL_PLAYLISTS, "Playlists"}, //Vista
{CSIDL_PROGRAM_FILES, "Program Files"},
{CSIDL_PROGRAMS, "Programs"},
{CSIDL_RECENT, "Recent"},
//{CSIDL_RESOURCES, "Resources"}, //Vista
//{CSIDL_SAMPLE_MUSIC, "Sample Music"}, //Vista
//{CSIDL_SAMPLE_PLAYLISTS, "Sample Playlists"}, //Vista
//{CSIDL_SAMPLE_PICTURES, "Sample Pictures"}, //Vista
//{CSIDL_SAMPLE_VIDEOS, "Sample Videos"}, //Vista
{CSIDL_STARTMENU, "Start Menu"},
{CSIDL_STARTUP, "Startup"},
//{CSIDL_ALTSTARTUP, "AltStartup"}, //?
{CSIDL_SYSTEM, "System"},
{CSIDL_QM_TEMP, "Temp"}, //no scidl. Normally CSIDL_LOCAL_APPDATA\Temp.
{CSIDL_TEMPLATES, "Templates"},
{CSIDL_PROFILE, "User Profile"}, //QM 2.3.0
{CSIDL_WINDOWS, "Windows"},
{CSIDL_COMMON_ADMINTOOLS, "Common Administrative Tools"},
{CSIDL_COMMON_DOCUMENTS, "Common Documents"},
{CSIDL_COMMON_FAVORITES, "Common Favorites"},
{CSIDL_COMMON_MUSIC, "Common Music"},
{CSIDL_COMMON_MUSIC, "CommonMusic"}, //alias, fbc
{CSIDL_COMMON_PICTURES, "Common Pictures"},
{CSIDL_COMMON_PICTURES, "CommonPictures"}, //alias, fbc
{CSIDL_COMMON_PROGRAMS, "Common Programs"},
{CSIDL_COMMON_STARTMENU, "Common Start Menu"},
{CSIDL_COMMON_STARTUP, "Common Startup"},
//{CSIDL_COMMON_ALTSTARTUP, "Common AltStartup"}, //?
{CSIDL_COMMON_TEMPLATES, "Common Templates"},
{CSIDL_COMMON_VIDEO, "Common Video"},
{CSIDL_COMMON_VIDEO, "CommonVideo"}, //alias, fbc
{CSIDL_QM_MYQM, "MyQM"}, //alias
{CSIDL_QM_TEMPQM, "Temp QM"}, //QM 2.3.5
{CSIDL_QM_DRIVE, "Drive"}, //QM 2.3.5


2. Environment variable name enclosed in %.


3. QM 2.2.0. CSIDL numeric value enclosed in $. For example, "$3$" expands to ITEMIDLIST string (see below) of Control Panel. To see available values, search for CSIDL in MSDN Library.


See also: str.expandpath.


Some objects in Window Explorer are not file system objects. Examples are Control Panel folder and most objects in it. They cannot be accessed using a file system path. They can be accessed using binary structures of type ITEMIDLIST. To simplify it, some QM functions (run, menust/toolbars, and some other) support ITEMIDLIST strings. These strings begin with ":: ". They are inserted when you drag and drop a non-file-system object. They also can be inserted using Run Program, Open File and Open Folder dialogs.




run ":: 14001F50E04FD020EA3A6910A2D808002B30309D" ;;My Computer
run "$0x11$" ;;My Computer
run ":: 14001F50E04FD020EA3A6910A2D808002B30309D 14002E1E2020EC21EA3A6910A2DD08002B30309D A90000009CFFFFFF1D002500433A5C57494E444F57535C73797374656D33325C6465736B2E63706C00446973706C6179004368616E67652074686520617070656172616E6365206F6620796F7572206465736B746F702C207375636820617320746865206261636B67726F756E642C2073637265656E2073617665722C20636F6C6F72732C20666F6E742073697A65732C20616E642073637265656E207265736F6C7574696F6E2E00" ;;Display
run "$3$ A90000009CFFFFFF1D002500433A5C57494E444F57535C73797374656D33325C6465736B2E63706C00446973706C6179004368616E67652074686520617070656172616E6365206F6620796F7572206465736B746F702C207375636820617320746865206261636B67726F756E642C2073637265656E2073617665722C20636F6C6F72732C20666F6E742073697A65732C20616E642073637265656E207265736F6C7574696F6E2E00" ;;Display
run ":: " ;;Desktop


The root object is Desktop. Its string is ":: ". It is not the same as "$desktop$, which is a file system folder.


File system objects also can be accessed using ITEMIDLIST. To insert ITEMIDLIST string, Shift + drag and drop.


See also: PidlToStr, PidlFromStr.

File search paths, relative paths

Some functions (run, str.searchpath, GetFileIcon, etc) don't require full path. Can be used only filename or relative path. Then they search in:


1. The QM directory. Before QM 2.3.3, run did not search here.

2. The current directory (GetCurDir/SetCurDir).

3. The 32-bit Windows system directory. 

4. The 16-bit Windows system directory.

5. The Windows directory.

6. The directories that are listed in the PATH environment variable.

7. run and str.searchpath also search in the registry "App Paths" key.


Some functions, including str.searchpath and GetFileIcon, at first search in $My QM$ special folder.


With some functions, .\ at the beginning means current directory; ..\ at the beginning means one level up from current directory. For example, if current directory is "c:\program files\quick macros 2", then "..\" will be "c:\program files\", and "..\otherapp" will be "c:\program files\otherapp". Also, whole path can be or contain "." and "..".


Read more: File names and paths


When you drag and drop a shortcut to the QM code editor, it inserts run with path of shortcut target. To insert shortcut path, Ctrl + drag and drop.


File functions may fail with mapped network drive paths (like "Z:\file"). Always use path like "\\server\share\file".


64-bit Windows has two System32 and Program Files folders. Read more.