VC Get Special Path (SpecialFolder)

Source: Internet
Author: User


%systemdrive%the partition number where the operating system is located. such as C:%SystemRoot%The operating system root directory. such as C:\WINDOWS%windir%The operating system root directory. such as C:\WINDOWS%allusersprofile%equivalent to C:\Documents and Settings\All Users%appdata%equivalent to C:\Documents and Settings\ user Directory \application Data%ProgramFiles%equivalent to C:\Program Files%commonprogramfiles%equivalent to C:\Program files\common Files%homedrive%the partition number where the operating system is located. such as: C:%homepath%equivalent to \documents and Settings\ user directory%USERPROFILE%equivalent to C:\Documents and Settings\ user directory%homedrive% =C + The partition where the system is currently started%SystemRoot% =C:\WINDOWS the directory where the system is currently started%windir% =%SystemRoot% =C:\WINDOWS the directory where the system is currently started%USERPROFILE% =C:\Documents and Settings\minamiko Current user data variables%homepath% =C:\Documents and Settings\minamiko Current user environment variables%system% =C:\WINDOWS\SYSTEM32%allusersprofile%: Lists the location of all user profile files. %appdata%: Lists the default location where the application data is stored. %cd%: Lists the current directory. %clientname%: Lists the NetBIOS name of the client when joining to a Terminal Services session. %cmdcmdline%: Lists the command line used to start the current Cmd.exe. %cmdextversion%: Command out the current command handler extension version number. %commonprogramfiles%: Lists the folder paths for commonly used files. %computername%: The computer name is listed. %comspec%: Lists the path to the executable command shell (command handler). %date%: Lists the current date. %errorlevel%: Lists the error codes for the most recently used commands. %homedrive%: Lists the drive letter that resides with the user's home directory. %homepath%: Lists the full path to the user's home directory. %homeshare%: Lists the network path of the user's shared home directory. %logonsever%: Lists the name of the domain controller that is valid for the current logon session. %number_of_processors%: Lists the number of processors installed on the computer. %os%: Lists the name of the operating system. (Windows XP and Windows -listed as Windows_NT.)%Path%: Lists the search paths for the executable files. %pathext%: Lists the file name extensions that the operating system thinks can be executed. %processor_architecture%: Lists the processor's chip architecture. %processor_identfier%: A description of the processor is listed. %processor_level%: Lists the model number of the computer's processor. %processor_revision%: The revision number of the processor is listed. %ProgramFiles%: Lists the path to the Program Files folder. %prompt%: Lists the command prompt settings for the current command interpreter. %random%: Lists the random decimal numbers bounded between 0 and 32767. %sessionname%: Lists the connection and session name when connecting to a Terminal Services session. %systemdrive%: Lists the drive where the Windows startup directory resides. %SYSTEMROOT%: Lists the location of the Windows startup directory. %temp% and%TMP%: Lists the default temporary directories for applications that are currently logged on by the user. %time%: Lists the current time. %userdomain%: Lists the name of the domain that contains the user account. %USERNAME%: Lists the name of the user who is currently logged on. %USERPROFILE%: Lists the current user profile location. %WINDIR%: Lists the location of the operating system directory. Variable type description%allusersprofile%returns the location of the all Users profile locally. %appdata%Local returns the location by default where the application stores data. %cd%returns the current directory string locally. %cmdcmdline%Local returns the exact command line used to start the current Cmd.exe. %cmdextversion%The system returns the version number of the current command handler extension. %computername%the system returns the name of the computer. %comspec%the system returns the exact path to the command-line interpreter executable program. The%date% system returns the current date. Use with date/T command in the same format. Generated by Cmd.exe. For more information about the date command, see Date. %errorlevel%the system returns the error code for the previous command. Errors are usually indicated by a value other than 0. %homedrive%the system returns the local workstation drive letter that is connected to the user's home directory. Set based on the value of the home directory. The user home directory is specified in Local Users and groups. %homepath%the system returns the full path of the user's home directory. Set based on the value of the home directory. The user home directory is specified in Local Users and groups. %homeshare%The system returns the network path of the user's shared home directory. Set based on the value of the home directory. The user home directory is specified in Local Users and groups. %logonserver%returns the name of the domain controller that validates the current logon session locally. %number_of_processors%The system specifies the number of processors installed on the computer. The%os% system returns the operating system name. Windows -displays its operating system as WINDOWS_NT. %PATH%The system specifies the search path for the executable file. %pathext%the system returns a list of file name extensions that the operating system considers executable. %processor_architecture%the system returns the chipset architecture of the processor. Value: x86 or IA64 (Itanium-based). %processor_identfier%The system returns the processor description. %processor_level%The system returns the model number of the processor installed on the computer. %processor_revision%the system returns the version number of the processor. %prompt%returns the command prompt settings for the current interpreter locally. Generated by Cmd.exe. %random% system return0To32767any decimal number between the. Generated by Cmd.exe. %systemdrive%the system returns a drive that contains the Windows server operating system root (that is, the root directory of the systems). %SYSTEMROOT%the system returns the location of the Windows server operating system root directory. %temp% and%TMP%The system and the user return the default temporary directory used by the application that is available to the currently logged-on user. Some applications require TEMP, while other applications require TMP. The%time% system returns the current time. Use with TIME/T command in the same format. Generated by Cmd.exe. For more information about the time command, see time. %userdomain%returns the name of the domain that contains the user account locally. %USERNAME%returns the name of the currently logged on user locally. %USERPROFILE%Local Returns the location of the current user's configuration file. %WINDIR%the system returns the location of the operating system directory. %temp% =%userprofile%\local Settings\Temp = C:\Documents and settings\minamiko\local settings\temp Current user Temp cache variable

The above are some of our common special paths, as long as the input in the resource browser can jump to the specific path.

We often use some paths in development, and here we introduce the method of obtaining special paths.

The function to be used here is SHGetSpecialFolderPath, and the prototype is

Boolshgetspecialfolderpath (       hwndhwndowner,       lptstrlpszpath,       int  Nfolder,       Boolfcreate);

Parameter description:

The first parameter of hWndOwner

A handle to the owner window, the client should specify if it displays a dialog box or message box.

The second parameter lpszpath

A pointer to a null-terminated string this receives the drive and path of the the specified folder. This buffer must is at least MAX_PATH characters in size.

A third parameter Nfolder

A CSIDL that identifies the folder of interest. If a virtual folder is specified, the This function would fail.

Detailed Visibility http://msdn.microsoft.com/zh-cn/library/windows/desktop/bb762494 (v=vs.85). aspx

Fourth parameter Fcreate

Indicates whether the folder should is created if it does not already exist. If This value is nonzero, the folder would be created. If This value is zero, the folder won't be created.

VC Get Special Path (SpecialFolder)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.