Is the HOME environment variable normally set in Windows?

17

1

To be clear, I'm not asking can it be set or how to set it, I'm asking is it already set at all on a new copy of Windows. The ideal way to find this out would be to install a fresh copy of Windows on a VM and check, since most of everybody who can answer this question will already have it set ;-)

I need to know if I can depend on it always being there. (I understand that these can be unset, but if you know how to do that you know you're asking for trouble.)

Sean Allred

Posted 2013-06-13T11:12:50.040

Reputation: 910

Answers

21

No, it is not. The closest equivalents in Windows NT are %UserProfile% and %HomeDrive%%HomePath% (note that they may point to different locations – the profile is always local, while the home can point to a network share).

user1686

Posted 2013-06-13T11:12:50.040

Reputation: 283 655

6

No.

The equivalent environment variables that are set are HOMEDRIVE and HOMEPATH.

Der Hochstapler

Posted 2013-06-13T11:12:50.040

Reputation: 77 228

3

There's also %LOCALAPPDATA% (never roaming) and %APPDATA% (can roam). You're not supposed to write to %UserProfile% directly, and you can't predict the relative path from %LOCALAPPDATA% to %APPDATA% (could be localized).

MSalters

Posted 2013-06-13T11:12:50.040

Reputation: 7 587

%LocalAppData% seems to be added in Vista; older versions have the directory but it can be only found using the shell API, not envvars. – user1686 – 2013-06-14T12:14:05.317