Erik,
1.]
I think that you do not use correct notation.
If I open Command prompt window and enter set home command, I can see the following lines
HOME=D:\users\mh
HOMEDRIVE=C:
HOMEPATH=\Users\mh
HOMEDRIVE value does not contain backslash at the end
HOMEPATH does contain backslash at the beginning
2.]
I think that in case that your workdir is set to X:\Users\(user's name)\work, the if command returns FALSE.
Martin Hanak