China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-12 16:49
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Discussion on the differences between the environment variables [systemdrive] and [homedrive] View 1,688 Replies 6
Original Poster Posted 2007-10-05 22:24 ·  中国 广东 广州 电信
银牌会员
★★★
Credits 1,206
Posts 517
Joined 2007-03-25 01:18
19-year member
UID 82819
Gender Male
Status Offline
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:
知,不觉多。不知,乃求知
Floor 2 Posted 2007-10-05 22:42 ·  中国 重庆 电信
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline
Didn't someone just post and discuss this issue the other day?
Floor 3 Posted 2007-10-05 23:59 ·  中国 安徽 马鞍山 电信
金牌会员
★★★★
Credits 3,946
Posts 1,884
Joined 2006-01-20 13:00
20-year member
UID 49283
Gender Male
Status Offline
In this way, I understand. Thanks.
Windows 一键还原
http://www.yjhy.com
Floor 4 Posted 2007-11-12 17:42 ·  中国 广东 广州 越秀区 电信
初级用户
Credits 176
Posts 24
Joined 2003-02-21 00:00
23-year member
UID 965
Gender Male
Status Offline
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.
Floor 5 Posted 2010-03-13 02:01 ·  中国 陕西 西安 电信
银牌会员
★★★★
钻石会员
Credits 2,278
Posts 1,020
Joined 2007-11-19 13:34
18-year member
UID 103127
Gender Male
Status Offline
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学习
Floor 6 Posted 2010-03-14 00:13 ·  中国 陕西 汉中 电信
初级用户
★★
Credits 128
Posts 122
Joined 2009-09-21 06:24
16-year member
UID 152378
Gender Male
Status Offline
Then both %systemroot% and %windir% refer to C:\windows. Are there any differences in some cases?
Floor 7 Posted 2010-03-14 14:49 ·  中国 吉林 延边朝鲜族自治州 延吉市 电信
银牌会员
★★★
正在学习中的菜鸟...
Credits 1,039
Posts 897
Joined 2009-03-01 15:34
17-year member
UID 140302
Gender Male
From 在地狱中仰望天堂
Status Offline
%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.
Forum Jump: