Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.
set HOME
HOMEDRIVE=C:
HOMEPATH=\
USERDOMAIN=user01
USERNAME=user01
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
add comment

1 Answer

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
add comment

Your Answer

 
discard

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.