中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-12 14:20
47,811 topics / 349,897 posts / today 0 new / 48,256 members
DOS批处理 & 脚本技术(批处理室) » Discussion on the differences between the environment variables [systemdrive] and [homedrive]
Printable Version  1,686 / 6
Floor1 flyinspace Posted 2007-10-05 22:24
银牌会员 Posts 517 Credits 1,206
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:
Floor2 HAT Posted 2007-10-05 22:42
版主 Posts 5,017 Credits 9,023
Didn't someone just post and discuss this issue the other day?
Floor3 lianjiang2004 Posted 2007-10-05 23:59
金牌会员 Posts 1,884 Credits 3,946
In this way, I understand. Thanks.
Floor4 forumz Posted 2007-11-12 17:42
初级用户 Posts 24 Credits 176
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.
Floor5 plp626 Posted 2010-03-13 02:01
银牌会员 Posts 1,020 Credits 2,278
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 ]
Floor6 jarry0932 Posted 2010-03-14 00:13
初级用户 Posts 122 Credits 128
Then both %systemroot% and %windir% refer to C:\windows. Are there any differences in some cases?
Floor7 Hanyeguxing Posted 2010-03-14 14:49
银牌会员 Posts 897 Credits 1,039 From 在地狱中仰望天堂
%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.
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023