Windows comes with environment variables

The so-called Windows environment variables refer to some setting options or attribute parameters of Windows specifying the working environment of the operating system, such as specifying the location of the system folder or temporary folder, etc. Compared with constants, an environment variable often consists of a variable name and a variable value, and the variable value can be reassigned, while the constant value is always fixed.

Windows has many built-in environment variables, record them. Priority of environment variables with the same name: user environment variables > system environment variables

1. Windows comes with environment variable description

variable explain
%ALLUSERSPROFILE% Returns the location of all User Profiles.
%APPDATA% Returns where the application stores data by default.
%CD% Returns the current directory string.
%CMDCMDLINE% Returns the exact command line used to start the current cmd.exe.
%CMDEXTVERSION% Returns the version number of the current Command Handler Extension.
%COMPUTERNAME% Returns the name of the computer.
%COMSPEC% Returns the exact path to the command line interpreter executable.
%DATE% Returns the current date. Use the same format as the date /t command. Generated by cmd.exe. See Date for details on the date command.
%ERRORLEVEL% Returns the error code of the most recently used command. Usually an error is indicated with a non-zero value.
%HOMEDRIVE% Returns the drive letter of the local workstation connected to the user's home directory. Settings based on home directory values. The user home directory is specified in "Local Users and Groups".
%HOMEPATH% Returns the full path to the user's home directory. Settings based on home directory values. The user home directory is specified in "Local Users and Groups".
%HOMESHARE% Returns the network path to the user's shared home directory. Settings based on home directory values. The user home directory is specified in "Local Users and Groups".
%LOGONSEVER% Returns the name of the domain controller authenticating the current logon session.
%NUMBER_OF_PROCESSORS% Specifies the number of processors installed on the computer.
%OS% Returns the name of the operating system. Windows now shows the operating system as Windows_NT.
%PATH% Specifies the search path for executable files.
%PATHEXT% Returns a list of file extensions that the operating system considers executable.
%PROCESSOR_ARCHITECTURE% Returns the chip architecture of the processor. Values: x86, IA64.
%PROCESSOR_IDENTFIER% Returns the processor description.
%PROCESSOR_LEVEL% Returns the model number of the processor installed on the computer.
%PROCESSOR_LEVEL% Returns the version number of the processor.
%PROMPT% Returns the command prompt settings for the current interpreter. Generated by cmd.exe.
%RANDOM% Returns any decimal number between 0 and 32767. Generated by cmd.exe.
%SYSTEMDRIVE% Returns the drive containing the Windows root directory (that is, the system root directory).
%SYSTEMROOT% Returns the location of the Windows root directory.
%TEMP% Returns the default temporary directory used by applications available to the currently logged in user. Some applications require TEMP, while others require TMP.
%TMP% ditto
%TIME% Returns the current time. Use the same format as the time /t command. Generated by cmd.exe. See Time for more information on the time command.
%USERDOMAIN% Returns the name of the domain containing the user account.
%USERNAME% Returns the name of the currently logged in user.
%UserPrefix% Returns the location of the current user's configuration file.
%WINDIR% Returns the location of the operating system directory.

2. Windows comes with environment variables

In Windows, Win+R opens the CMD window, and enter set to print the default environment variables of the current computer.

Microsoft Windows [版本 10.0.22621.1555]
(c) Microsoft Corporation。保留所有权利。

C:\Users\st220>set
ALLUSERSPROFILE=C:\ProgramData
APPDATA=C:\Users\st220\AppData\Roaming
CommonProgramFiles=C:\Program Files\Common Files
CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
CommonProgramW6432=C:\Program Files\Common Files
COMPUTERNAME=SUNSHUAI
ComSpec=C:\WINDOWS\system32\cmd.exe
DriverData=C:\Windows\System32\Drivers\DriverData
EFC_17316=1
FPS_BROWSER_APP_PROFILE_STRING=Internet Explorer
FPS_BROWSER_USER_PROFILE_STRING=Default
HOMEDRIVE=C:
HOMEPATH=\Users\st220
LOCALAPPDATA=C:\Users\st220\AppData\Local
LOGONSERVER=\\SUNSHUAI
NUMBER_OF_PROCESSORS=20
OneDrive=C:\Users\st220\OneDrive
OS=Windows_NT
Path=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Users\st220\AppData\Local\Microsoft\WindowsApps;;D:\app\Microsoft VS Code\bin
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
PROCESSOR_ARCHITECTURE=AMD64
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 154 Stepping 3, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=9a03
ProgramData=C:\ProgramData
ProgramFiles=C:\Program Files
ProgramFiles(x86)=C:\Program Files (x86)
ProgramW6432=C:\Program Files
PROMPT=$P$G
PSModulePath=C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
PUBLIC=C:\Users\Public
SESSIONNAME=Console
SystemDrive=C:
SystemRoot=C:\WINDOWS
TEMP=C:\Users\st220\AppData\Local\Temp
TMP=C:\Users\st220\AppData\Local\Temp
USERDOMAIN=SUNSHUAI
USERDOMAIN_ROAMINGPROFILE=SUNSHUAI
USERNAME=st220
USERPROFILE=C:\Users\st220
windir=C:\WINDOWS
ZES_ENABLE_SYSMAN=1

set

3. Summary

work hard together! ! !

Guess you like

Origin blog.csdn.net/qq_30595441/article/details/130280745
Recommended