[Computer use] Windows commonly used predefined environment variables

Constantly updated!

reference link

environment variable actual path
%ALLUSERSPROFILE% C:\ProgramData
%APPDATA% C:\Users\username\AppData\Roaming
%COMMONPROGRAMFILES% C:\Program Files\Common Files
%COMMONPROGRAMFILES(x86)% C:\Program Files (x86)\Common Files
%COMSPEC% C:\Windows\System32\cmd.exe
%HOMEDRIVE%and%SystemDrive% C:\
%HOMEPATH% C:\Users\username
%LOCALAPPDATA% C:\Users\username\AppData\Local
%PROGRAMDATA% C:\ProgramData
%PROGRAMFILES% C:\Program Files
%PROGRAMFILES(X86)% C:\Program Files (x86)
%PUBLIC% C:\Users\username\Public
%SystemRoot% C:\Windows
%TEMP%and%TMP% C:\Users\username\AppData\LocalTemp
%USERPROFILE% C:\Users\username
%WINDIR% C:\Windows

It is worth mentioning that these predefined environment variables are case-insensitive , so you only need to memorize words.

  • requires attention:

  If it is in the address bar of the file explorer, you can use %%the symbol directly, but if it is in the command line, you cannot use this format, the terminal cannot recognize it, and you need to use the special method of environment variables:

cd $env:USERPROFILE

$env:<环境变量>the format of

Guess you like

Origin blog.csdn.net/ZHOU_YONG915/article/details/130133679