首页 > 编程 > BAT > 正文

编程用到的windows系统目录变量简写

2020-06-09 13:53:49
字体:
来源:转载
供稿:网友
%ALLUSERSPROFILE% C:/Documents and Settings/All Users
%USERPROFILE% C:/Documents and Settings/当前用户名
%HOMEPATH% C:/Documents and Settings/当前用户名
%SYSTEMROOT% C:/WINDOWS
%WINDIR% C:/WINDOWS
%ComSpec% C:/WINDOWS/System32/cmd.exe
%APPDATA% C:/Documents and Settings/当前用户名/Application Data
%ALLAPPDATA% C:/Documents and Settings/All Users/Application Data
%SYSTEMDRIVE% C:
%HOMEDRIVE% C:
%TEMP% 和 %TMP% C:/Documents and Settings/当前用户名/Local Settings/Temp
%ProgramFiles% C:/Program Files
%CommonProgramFiles% C:/Program Files/Common Files
Docum~1 Documents and Settings
progra~1 Program Files

编程用的到:
%ALLUSERSPROFILE% C:/Documents and Settings/All Users
%USERPROFILE% C:/Documents and Settings/当前用户名
%HOMEPATH% C:/Documents and Settings/当前用户名
%SYSTEMROOT% C:/WINDOWS
%WINDIR% C:/WINDOWS
%ComSpec% C:/WINDOWS/System32/cmd.exe
%APPDATA% C:/Documents and Settings/当前用户名/Application Data
%ALLAPPDATA% C:/Documents and Settings/All Users/Application Data
%SYSTEMDRIVE% C:
%HOMEDRIVE% C:
%TEMP% 和 %TMP% C:/Documents and Settings/当前用户名/Local Settings/Temp
%ProgramFiles% C:/Program Files
%CommonProgramFiles% C:/Program Files/Common Files
Docum~1 Documents and Settings
progra~1 Program Files
%systemdrive%:Windows系统所在磁盘分区,通常就是C盘的根目录
%systemroot%,%windir%:Windows系统所在的目录,通常是C:/Winows
%programfiles%:通常情况下是C:/program files
%commonprogramfiles%:公用文件目录,通常是C:/program files/common files
%userprofile%:当前账户的用户目录,通常是C:/documents and settings/当前用户名
%alluserprofile%:所有用户的用户目录,通常是C:/documents and settings/all user
%temp%,%tmp%:当前用户的临时文件目录,通常是C:/documents and settings/当前用户名/local settings/temp

所谓的Windows系统目录简写环境变量,就是为一些常用且固定的Windows系统目录的路径建立一个与之对应的相对简单的缩写,使之更容易输入或定位。

Windows系统默认情况下都是安装在电脑C盘的Windows目录下,但这并不是固定的,如果你的系统不是安装在这个目录下,那么程序想要定位你的某个系统目录的话,就需要使用到目录简写环境变量了。使用这些环境变量,程序员或系统管理员无需事先了?解你的系统安装位置,就能轻易的找到所要使用的系统目录路径。

下面,我就来为大家介绍一些常见的Windows系统目录简写环境变量:
%SYSTEMDRIVE%
这代表的是Windows系统所在磁盘分区,也就是Windows系统所安装到的盘符根目录,通常就是C盘的根目录了。
%HOMEDRIVE%
这和上面介绍的%SYSTEMDRIVE%的功能是一样的。
%SYSTEMROOT%
它所指向的是Windows系统所在的目录,通常就是C:/Windows。
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表