PathUnExpandEnvStrings function
Replaces certain folder names in a fully qualified path with their associated environment string.
Syntax
BOOL PathUnExpandEnvStrings( _In_ LPCTSTR pszPath, _Out_ LPTSTR pszBuf, _In_ UINT cchBuf );
Parameters
- pszPath [in]
-
Type: LPCTSTR
A pointer to a null-terminated string of maximum length MAX_PATH that contains the path to be unexpanded.
- pszBuf [out]
-
Type: LPTSTR
A pointer to a buffer that, when this method returns successfully, receives the unexpanded string. The size of this buffer must be set to MAX_PATH to ensure that it is large enough to hold the returned string.
- cchBuf [in]
-
Type: UINT
The size, in characters, in the pszBuf buffer.
Return value
Type: BOOL
Returns TRUE if successful; otherwise, FALSE.
Remarks
The following folder paths are replaced by their equivalent environment string.
| Folder | Environment String |
|---|---|
| The All Users profile folder | %ALLUSERSPROFILE% |
| The current user's application data folder (Windows Vista and later only). | %APPDATA% |
| The system name | %COMPUTERNAME% |
| The Program Files folder | %ProgramFiles% |
| The system root folder | %SystemRoot% |
| The system drive letter | %SystemDrive% |
| The current user's profile folder | %USERPROFILE% |
The environment variables listed in the above table might not all be set on all systems. If an environment variable is not set, it is not unexpanded.
Requirements
|
Minimum supported client |
Windows 2000 Professional, Windows XP [desktop apps only] |
|---|---|
|
Minimum supported server |
Windows 2000 Server [desktop apps only] |
|
Header |
|
|
Library |
|
|
DLL |
|
|
Unicode and ANSI names |
PathUnExpandEnvStringsW (Unicode) and PathUnExpandEnvStringsA (ANSI) |
See also