Programming Windows system directory variables shorthand _dos/bat

Source: Internet
Author: User
%allusersprofile% C:\Documents and Settings\All Users
%USERPROFILE% C:\Documents and Settings\ Current user name
%homepath% C:\Documents and Settings\ Current user name
%SYSTEMROOT% C:\WINDOWS
%WINDIR% C:\WINDOWS
%comspec% C:\WINDOWS\System32\cmd.exe
%appdata% C:\Documents and Settings\ Current user name \application Data
%allappdata% C:\Documents and Settings\All Users\Application Data
%systemdrive% C:
%homedrive% C:
%TEMP% and%TMP% C:\Documents and Settings\ Current user name \local Settings\Temp
%ProgramFiles% C:\Program Files
%commonprogramfiles% C:\Program Files\Common Files
Docum~1 Documents and Settings
Progra~1 program Files

programming to
%allusersprofile% C:\Documents and Settings\All Users
%USERPROFILE% C:\Documents and Settings\ Current user name
%homepath% C:\Documents and Settings\ Current user name
%SYSTEMROOT% C:\WINDOWS
%WINDIR% C:\WINDOWS
%comspec% C:\WINDOWS\System32\cmd.exe
%appdata% C:\Documents and Settings\ Current user name \application Data
%allappdata% C:\Documents and Settings\All Users\Application Data
%systemdrive% C:
%homedrive% C:
%TEMP% and%TMP% C:\Documents and Settings\ Current user name \local Settings\Temp
%ProgramFiles% C:\Program Files
%commonprogramfiles% C:\Program Files\Common Files
Docum~1 Documents and Settings
Progra~1 program Files
The disk partition on which the%systemdrive%:windows system resides, usually the root of the C disk
The directory where the%systemroot%,%windir%:windows system is located, usually the C:\Winows
%programfiles%: Normally it's C:\program files.
%commonprogramfiles%: Common file directory, usually C:\program files\common files
%userprofile%: User directory for current account, usually C:\documents and Settings\ current user name
%alluserprofile%: User directory for all users, usually C:\documents and Settings\All users
%temp%,%tmp%: The current user's temporary file directory, usually the C:\documents and Settings\ current username \local Settings\Temp

The so-called Windows System directory shorthand environment variable is a relatively simple abbreviation for some common and fixed Windows directory paths, making it easier to enter or locate.

Windows system is installed by default in the computer C disk in the Windows directory, but this is not fixed, if your system is not installed in this directory, then the program to locate your system directory, you need to use the directory shorthand environment variables. Using these environment variables, the programmer or system administrator does not need to be in advance. To solve your system installation location, you can easily find the system directory path you want to use.

Next, I'll show you some common Windows system directory shorthand environment variables:
%systemdrive%
This represents the disk partition on which the Windows system resides, which is the Fugen directory of disks installed by the Windows system, usually the root of the C disk.
%homedrive%
This is the same as the function of the%systemdrive% described above.
%SYSTEMROOT%
It points to the directory where the Windows system is located, usually C:\Windows.
%WINDIR%
Same as%systemroot%, pointing to the directory where Windows resides.
%ProgramFiles%
The path to program files is usually C:\Program files.
%commonprogramfiles%
Points to the Common Files (Common files) directory, usually C:\Program files\common files.
%USERPROFILE%
A user directory that points to the current account, usually C:\Documents and Settings\ the current user name.
%homepath%
The function is the same as the%userprofile% above.
%allusersprofile%
A user directory that points to all users, usually C:\Documents and Settings\All users.
%appdata%
Refers to the current user's application Data directory, typically the C:\Documents and Settings\ current username \application Data.
Many articles will introduce a variable called%allappdata% that points to C:\Documents and Settings\All Users\Application Data, but this variable is not available.
%TEMP%
It points to the current user's temporary file directory, usually the C:\Documents and Settings\ current username \local Settings\Temp.
%TMP%
Is the same as the%temp% point.
%comspec%
Point to C:\WINDOWS\System32\cmd.exe, which is the command prompt.
Related Article

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.