Skip to main content
Version: 20 R7 BETA

System folder

System folder {( type )} -> Function result

ParameterTypeDescription
typeIntegerType of system folder
Function resultStringPathname to a system folder

Description

The System folder command returns the pathname to a particular folder of the operating system or to the active Windows or macOS System folder itself.

You pass in the optional type parameter a value indicating the type of system folder. 4D provides you with the following predefined constants, placed in the “System Folder” theme:

ConstantTypeValueComment
Applications or program filesLongint16
DesktopLongint15
Documents folderLongint17"Documents" folder of user
Favorites WinLongint14
FontsLongint1
Home folderLongint18Current home folder of the user (usually "/Users//")
Start menu Win_allLongint8
Start menu Win_userLongint9
Startup Win_allLongint4
Startup Win_userLongint5
SystemLongint0
System WinLongint12
System32 WinLongint13
User preferences_allLongint2
User preferences_userLongint3

Notes:

  • The constants suffixed Win can be used on Windows only. When they are used on macOS, System folder will return an empty string.
  • The pathnames to some system folders can specific to the current user. Constants 2 to 9 allow you to choose whether you want to obtain the pathname to a folder which is shared by all users, or customized for the current user.

If you omit the type parameter, the function will return the pathname to active System folder (= constant System).

See also

Get 4D folder
Temporary folder