HomeDrive vs. SystemDrive

On my computer, these two variables gives the same result:

echo %HomeDrive% -> C:
echo %SystemDrive% -> C:

Is there any difference between them?

Reference links are welcome, because it's too easy to say something like "yes, they are the same" just because they are the same on one's particular computer.

1

2 Answers

Big difference.

The %systemdrive% (typically c:) is the partition with the %systemroot% (typically Windows) directory.

%homedrive% is typically your network root profile directory, in an (Active Directory) Domain, it would reside on a server.

The web links to their expanded descriptions are rich and voluminous, you could easily find more info about them at Microsoft.com.

2

In answer to @StevenPenny asking for sourced answers: There are surprisingly few such, and almost none from Microsoft. Below are a few sources.

Relocation of the Users and the ProgramData directories to a drive other than the drive that has the Windows directory

One of the few sources by Microsoft:

%systemdrive% is defined as the drive that contains the Windows directory.

HOMEPATH

On a Microsoft Windows system, the %HOMEPATH% is the name for what Unix/Linux users call $HOME. When combined with the %HOMEDRIVE% environment variable you get a complete path to the user's home directory.

For example, if your username is “JRandom” then your home drive and path is probably one of the following:

C:\Users\JRandom (Windows 7 and newer)
C:\Documents and Settings\JRandom (XP and older)

Windows environment variables

VariablePossible valueregistry
HOMEDRIVEC:The combination of HOMEDRIVE and HOMEPATH points to a location where personal files should be stored. It might, but needs not to, be the same directory as %USERPROFILE%HKCU\Volatile Environment
HOMEPATH\Users\ReneRene correpsonds to %USERNAME%. Compare with %USERPROFILE%HKCU\Volatile Environment

PowerShell : About Automatic Variables

Another Microsoft article that mentions these variables:

$HOME

Contains the full path of the user's home directory. This variable is the equivalent of the "$env:homedrive$env:homepath" Windows environment variables, typically C:\Users<UserName>.

0

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like