|
flyinspace
银牌会员
    
积分 1206
发帖 517
注册 2007-3-25
状态 离线
|
『楼 主』:
论环境变量[systemdrive][homedrive]之间的区别
使用 LLM 解释/回答一下
首先在这里还是抄现饭:
%systemdrive%:系统安装的磁盘分区
%homedrive%:当前用户系统所在分区
当我们在看到这两个变量的时候,大多数情况下,这两个变量的值都是一样的
他们的值通常都是 c:
于是,就有人不明白了,既然这两个的值是一样的,为什么要有两个变量呢?
那么,我们就应该从这两个变量的名称来解释一下了。
systemdrive,从名字上来看,就是安装windows时,windows 所在的分区的盘符..
homedrive,就是当前登陆的用户所存放的配置文件所在的目录:
通常我们的用户配置文件如下,假设用户名为user,windows 安装在c盘:
c:\Documents and Settings\User
呵呵,但如果我们把用户的配置文件改一个地方,放到d盘里去.那么我们的用户配置文件就成了: d:\Documents and Settings\User
我们的homedrive 的值在这个时候就变成了d:
好了,我的论叙就到这里了。欢迎大家指正我的错误:
First of all, here I'm just repeating old stuff:
%systemdrive%: the disk partition where the system is installed
%homedrive%: the partition where the current user's system is located
When we see these two variables, in most cases, the values of these two variables are the same
Their values are usually c:
So, some people don't understand. Since these two values are the same, why are there two variables?
Then, we should explain from the names of these two variables.
systemdrive, from the name, is the drive letter of the partition where Windows is installed when Windows is installed..
homedrive is the directory where the configuration files of the currently logged-in user are stored:
Usually our user configuration files are as follows. Suppose the user name is user and Windows is installed on drive C:
c:\Documents and Settings\User
Hehe, but if we change the user's configuration files to another place and put them on drive D, then our user configuration files become: d:\Documents and Settings\User
At this time, the value of our homedrive becomes d:
Well, my discussion is here. Welcome everyone to correct my mistakes:
|

知,不觉多。不知,乃求知 |
|
2007-10-5 22:24 |
|
|
HAT
版主
       
积分 9023
发帖 5017
注册 2007-5-31
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
前几天不是刚刚有人发帖讨论过这个问题么?
Didn't someone just post and discuss this issue the other day?
|
|
2007-10-5 22:42 |
|
|
lianjiang2004
金牌会员
     
积分 3946
发帖 1884
注册 2006-1-20
状态 离线
|
|
2007-10-5 23:59 |
|
|
forumz
初级用户
 
积分 176
发帖 24
注册 2003-2-21
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
除了这两个关于系统分区的变量外还有没有变量是指明系统的启动分区呢?
例如 ntdect.com boot.ini等文件所在的分区, 虽然说一般这个区对应盘符是C盘,但想写个比较通用处理情况.
Are there any other variables that indicate the system's boot partition besides these two variables related to the system partition? For example, the partition where files like ntdect.com and boot.ini are located. Although generally this partition corresponds to drive letter C, I want to write a more general way to handle situations.
|
|
2007-11-12 17:42 |
|
|
plp626
银牌会员
     钻石会员
积分 2278
发帖 1020
注册 2007-11-19
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
Originally posted by flyinspace at 2007-10-5 10:24 PM:
首先在这里还是抄现饭:
%systemdrive%:系统安装的磁盘分区
%homedrive%:当前用户系统所在分区
当我们在看到这两个变量的时候,大多数情况下,这两个 ...
老帖了,翻来再看才知道在我这里不是这样子的。。。
我的set
->cd
D:\Documents_and_Settings\桌面
->set
ALLUSERSPROFILE=C:\Documents and Settings\All Users
APPDATA=D:\Documents_and_Settings\Application Data
CLIENTNAME=Console
CommonProgramFiles=C:\Program Files\Common Files
COMPUTERNAME=20100310-2204
ComSpec=C:\WINDOWS\system32\cmd.exe
FP_NO_HOST_CHECK=NO
HOMEDRIVE=C:
HOMEPATH=\Documents and Settings\Administrator
LOGONSERVER=\\20100310-2204
mycmd=D:\program files\mycmd
NUMBER_OF_PROCESSORS=2
OS=Windows_NT
Path=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wb
n32;D:\program files\mycmd
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_IDENTIFIER=x86 Family 6 Model 15 Stepping 13, Ge
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=0f0d
ProgramFiles=d:\Program Files
PROMPT=-$g
SESSIONNAME=Console
SystemDrive=C:
SystemRoot=C:\WINDOWS
TEMP=D:\DOCUME~1\LOCALS~1\Temp
TMP=D:\DOCUME~1\LOCALS~1\Temp
USERDOMAIN=20100310-2204
USERNAME=plp
USERPROFILE=D:\Documents_and_Settings
windir=C:\WINDOWS
Last edited by plp626 on 2010-3-13 at 02:03 ]
Originally posted by flyinspace at 2007-10-5 10:24 PM:
First, here I still repeat the old information:
%systemdrive%: The disk partition where the system is installed
%homedrive%: The partition where the current user system is located
When we see these two variables, most of the time, these two ...
It's an old post. When I look at it again, I realize it's not like this on my side...
My set
->cd
D:\Documents_and_Settings\Desktop
->set
ALLUSERSPROFILE=C:\Documents and Settings\All Users
APPDATA=D:\Documents_and_Settings\Application Data
CLIENTNAME=Console
CommonProgramFiles=C:\Program Files\Common Files
COMPUTERNAME=20100310-2204
ComSpec=C:\WINDOWS\system32\cmd.exe
FP_NO_HOST_CHECK=NO
HOMEDRIVE=C:
HOMEPATH=\Documents and Settings\Administrator
LOGONSERVER=\\20100310-2204
mycmd=D:\program files\mycmd
NUMBER_OF_PROCESSORS=2
OS=Windows_NT
Path=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wb
n32;D:\program files\mycmd
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_IDENTIFIER=x86 Family 6 Model 15 Stepping 13, Ge
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=0f0d
ProgramFiles=d:\Program Files
PROMPT=-$g
SESSIONNAME=Console
SystemDrive=C:
SystemRoot=C:\WINDOWS
TEMP=D:\DOCUME~1\LOCALS~1\Temp
TMP=D:\DOCUME~1\LOCALS~1\Temp
USERDOMAIN=20100310-2204
USERNAME=plp
USERPROFILE=D:\Documents_and_Settings
windir=C:\WINDOWS
Last edited by plp626 on 2010-3-13 at 02:03 ]
|

山外有山,人外有人;低调做人,努力做事。
进入网盘(各种工具)~~ 空间~~cmd学习 |
|
2010-3-13 02:01 |
|
|
jarry0932
初级用户
 
积分 128
发帖 122
注册 2009-9-21
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
那么 %systemroot% 和 %windir% 这两个都是指C:\windows,是不是在某些情况下也有区别?
Then both %systemroot% and %windir% refer to C:\windows. Are there any differences in some cases?
|
|
2010-3-14 00:13 |
|
|
Hanyeguxing
银牌会员
     正在学习中的菜鸟...
积分 1039
发帖 897
注册 2009-3-1 来自 在地狱中仰望天堂
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
%SYSTEMDRIVE% 系统 返回包含 Windows XP 根目录(即系统根目录)的驱动器。
%SYSTEMROOT% 系统 返回 Windows XP 根目录的位置。
%WINDIR% 系统 返回操作系统目录的位置。
单纯从系统来说,%SYSTEMROOT%仅可用于2000以后的系统,而%WINDIR%则可以兼容到95。
%HOME...%一类的变量,主要用于域内的返回,其他变量仅用于本地返回。
%SYSTEMDRIVE% System Returns the drive that contains the root directory of Windows XP (that is, the system root directory).
%SYSTEMROOT% System Returns the location of the Windows XP root directory.
%WINDIR% System Returns the location of the operating system directory.
Purely from the system's perspective, %SYSTEMROOT% can only be used in systems after 2000, while %WINDIR% can be compatible with 95.
Variables like %HOME...% are mainly used for returns within the domain, and other variables are only used for local returns.
|

批处理之家 http://bbs.bathome.net/forum-5-1.html |
|
2010-3-14 14:49 |
|