Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
set HOME
USERPROFILE=C:\Documents and Settings\user01

Microsoft Windows XP [Version 5.1.2600]

On the Windows boxes I've tested until now, USERPROFILE=%HOMEDRIVE%%HOMEPATH%

When I originallydecided to go with HOMEDRIVE/HOMEPATH, I read an article that said it was the safest way to go.

What would be causing HOMEPATH to be /?

If commands are needed to be executed on this machine, please put them in the form of a batch file. Thank you.

share|improve this question
It looks to me like your install of Windows is setup in a non standard way. All three Windows ( XP x2 and 7) in my home show the standard config. Home at the root of c: seems dangerous to me. – tomjedrz Nov 18 '09 at 3:24
While having the home reflect the root of the share isn't typical, it's not necessarily improperly configured. Applications should not rely on those environment variables. I can't think of any reason (off of the top of my head) why having home at the root of C: would be dangerous. – Stemen Nov 18 '09 at 16:01
up vote 1 down vote accepted

HOMEPATH can be set to an equivalent of either %USERPROFILE% or the root of %HOMEDRIVE%. For scripts that you're writing on DOS/CMD on modern versions of windows (XP/Vista), you should use %USERPROFILE%.

That said, if you're writing an application (or vbs, etc), get the shell folders list from windows, as it is (generally) more accurate/reliable than %userprofile%.

share|improve this answer
I found another circumstance where the HOMEDRIVE and HOMEPATH variables do not exist. I have not been able to reproduce problem. – TJR Jan 19 '10 at 16:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.