Windows – How to move the home directory of current user into another place, in Windows XP

windows xp

Current, the home of current user is:

C:\Documents and Settings\freewind

It contains many other directories, e.g. My Documents, Desktop

Now I want to move the whole directory to another place, for example:

D:\freewind

Then if I want to run this Java code:

System.out.println(System.getProperty("user.home"))

It will print D:\freewind.

Is it possible?

Best Answer

  • Java uses the %USERPROFILE% environmental variable, but if you want to move the home directory to some other folder or other drive, this is a bit tricky.

    Here is a very well explained blog post about how to move the Windows User Profile to another directory, written by Keith Survell.

    The idea is to use NTFS junction points. Here are the basic steps:

    • Make a thorough backup
    • Create a second user account and log into this one
    • Move the complete user's directory contents to the new folder, e.g. from C:\Users\JohnDoe to C:\JohnDoe. This can be done by just drag/dropping in Windows Explorer.
    • Rename the old User directory to something else (e.g. JohnDoe.old)
    • Open the command prompt and enter

      mklink /J C:\Users\JohnDoe C:\JohnDoe
      
    • Log out of the temporary user profile

    Keith appears to like Super User. I couldn't find you though. If you're reading this, please feel free to expand or comment!