$syspath function


The $syspath function returns one of a number of predefined system-specific folder paths, for example the 32-bit system folder on a 64-bit system. If index refers to a non-existing folder, the result is an empty string.

Note: In most cases, the same folder location is already available as one of the predefined symbolic folders. If available, we strongly recommend that you use the predefined folders instead of the $syspath function for greater cross-platform robustness and error checking.


All parameters may contain symbolic references; these are resolved before the function is applied. See Examples below.

Index of the desired folder path; see below for a full list of currently defined indices.

Available folder path indices

The following system folder path indices are currently defined. Note that not all system paths exist on all Windows versions; if a path does not exist on the target system, the $syspath function returns an empty string.

Index Folder Example path Preferred symbol
0 Native system folder (32-bit or 64-bit depending on the target system). Corresponds to the GetSystemDirectory() Win32 API. C:\Windows\System32 SystemXFolder
1 WoW64 system folder (folder for 32-bit DLLs on 64-bit systems). Corresponds to the GetSystemWow64Directory() Win32 API. C:\Windows\SysWOW64 n/a
2 Current user's Windows folder (if running on a shared Windows system, then this is a folder that is private to the current user). Corresponds to the GetWindowsDirectory() Win32 API. C:\Windows WindowsFolder
3 System's Windows folder, shared among all users. Corresponds to the GetSystemWindowsDirectory() Win32 API. C:\Windows n/a
4 Current user's temporary files folder. Corresponds to the GetTempPath() Win32 API. C:\Users\You\AppData\Local\Temp TempFolder
5 Profiles root folder. Corresponds to the GetProfilesDirectory() Win32 API. C:\Users ProfilesFolder
6 All Users' (common) profiles folder. Corresponds to the GetAllUsersProfileDirectory() Win32 API. C:\ProgramData CommonProfileFolder
7 Current user's profile folder. Corresponds to the GetUserProfileDirectory() Win32 API. C:\Users\YourName ProfileFolder
8 .Net installation folder of highest available .Net version. Corresponds to the GetCORSystemDirectory() Win32 API. C:\Windows\Microsoft.NET\Framework\v4.0.30319 n/a
9 .Net assembly cache root folder. Corresponds to the GetCachePath() Win32 API. C:\Windows\assembly GlobalAssemblyCache


Here are some usage examples for this function:

Returns the path to the native Windows System folder (i.e., 32-bit on 32-bit system and 64-bit on 64-bit systems), which is usually C:\Windows\System32.
Returns the path to the 32-bit Windows System folder on 64-bit systems, or an empty string on 32-bit systems. On 64-bit systems, this path is typically C:\Windows\SysWOW64.

See also

Predefined symbolic folders, $shpath runtime function