178 comments

  1. This did not work for me. I cannot move the Appdata folder even though when prompted to give permission. How do you move the c:\Users\\Appdata folder?

  2. Make sure you are logged in as a different user before trying to move anything under your normal user profile’s account – otherwise, files will be in use and you can’t move them. (See Step #2.)

    And I assume you mean C:\Users\[YourUserName]\Appdata?

  3. I’m logged in as a temp user I created, but it still thinks there are files in use in the other user’s folder. Argh! (I even rebooted to make sure).

  4. Also, be careful (mildly so) as it’ll mangle permissions somewhat – I was being told I needed permission from the other user to move files! (we’re both Administrators…uh…what?)

  5. Files may be in use in your profile especially if you have “services” running that use files in the user profile you used when they were installed. Since Windows Services run all the time (regardless of who is logged in) you may need to shut them down.

    One way to help with this is to reboot into “Safe Mode” under the 2nd account and then move your files. Being in “Safe Mode” helps ensure that no pesky programs/services have locked files in the user profile you’re trying to move.

    Also, depending on WHERE you move your user profile to, you may need to change the permissions – Windows permissions are not inherited across directory junctions, I believe. There’s no hard and fast rule for this, so just keep your wits about you and you should be OK.

  6. I’ve tried this, but the problem I get, when I log back in it creates a temp user folder because it can’t find mine. This, I think, is due to the mklink comand having to create the User name folder to work. I had to delete my original user name folder for mklink to work. Can’t seem to get a grip on how to get around this.

  7. I can’t remember whether the mklink /j command needs the “source” directory to be there, or if it doesn’t… that might be the source of the problem.

    The way to test it is to see if you can browse to C:\Users\UserName and have it show you exactly what you’d expect to see (your user profile). If you can do this using Explorer, then Windows itself should find your profile no sweat.

    Another thing to consider is this:

    When you copy your user profile to the new location, make sure you have turned off the option in Windows to “hide system files” – otherwise you won’t copy the actual “user profile” files (e.g., ntuser.dat) and that will cause Windows to not use your new profile location.

    Anyway, I hope that helps!

  8. I think you may not need the J switch… If you are on Vista+ the ‘mklink’ command defaults to creating a smylink for FILES, I believe. So to create a symbolic link for a whole directory try; “mklink /D D:\DestinationDirectory C:\User\Username”

    From the Windows mkdir command help:
    Creates a symbolic link.
    mklink [[/D] | [/H] | [/J]] link target
    D – Creates a directory symbolic link. Default is a file symbolic link.
    /H – Creates a hard link instead of a symbolic link.
    /J – Creates a Directory Junction.
    Link – specifies the new symbolic link name.
    Target – specifies the path (relative or absolute) that the new link refers to.

  9. Yes, the mklink command does default to creating symbolic links. I just prefer directory junctions myself, as they are supported on earlier versions of Windows – whereas symbolic links are only supported in Vista (and later).

  10. Wouldn’t you also have an issue if the junction drive (in this case C:) were to fail? The junction info is stored on C:, so it seems to me that if that drive failed, bye bye to your junctions.

  11. Well, yes, and no. If the junction drive (C:) were to fail, yes, you’d lose the junction – but your profile itself (the files and folders) is still accessible on the 2nd drive. If you plugged the 2nd drive into another computer, you’d be able to browse it just fine – all your files would be there. (They just wouldn’t be linked to your user profile anymore, which is completely understandable!)

    Of course, if your C: drive fails you’ve got bigger issues to deal with than just your junction information being lost.

  12. Hi, Keithius.
    Very interesting thread.

    But, what if I need to move the whole C:\Users to D:\Users, with the posibility for all new future user profiles to be created in the new location?

    This method ensures me that? Is not better to change the Environment Varibles in the Registry without make links in the NTFS structure? (with the posterior search & replace of values to the new location).

    I think your method only works for actual users but not for future users. I´m wrong ?

    thanx for any reply.

  13. Directory junctions are implemented at the filesystem level, so they are transparent to any applications running above them – including Windows itself (although Explorer is smart enough to check for them when it matters, such as when calculating free disk space and when recursively deleting a folder).

    Because of this, they will work for moving the entire “Users” folder… but doing that is a bit trickier, since you need to be logged on in order to make a junction, and if you’re logged on, you can’t move your user profile folder (unless, of course, it’s already located somewhere else). So moving the ENTIRE C:\Users folder is quite a bit harder, simply because you’ve normally got some in-use “locked files” in there, so you can’t really “move” it per se. It’s sort of a chicken and egg problem.

    But technically speaking, yes, junctions could indeed be used to move the entire Users folder somewhere else, and if you did, all future user profiles would be created in that new location.

  14. The solution here is the Installer DVD command prompt. I´ll do some tests with this method. Seems to be a good option.

  15. It would have been a nice feature to have had the ability during user creation to specify where the users profile (documents, pics, video, etc.) during account creation.

  16. Has anyone tried this with Windows 7? I had to problem moving the original user account files and creating the junction point. However, when I tried to move/copy the files back into C:\Users\Sheldon (while signed on under a different account), there was a handful of files that I couldn’t move or copy back. I tried booting up in safe mode, stopped all the services I could, etc, but could not get those puppies to transfer. I got the “need admin access” message, but I had that.
    Anyways, I decided to try booting up to my account without those files. It started up ok, but all my user account settings were gone, so I just restored from backup. I would love it if I could get this to work, as it’s exactly what I was looking for. Anyone know how to get those last few files to move back?

  17. Here are the folders that I could not copy back to my user account after setting up the junction point:
    C:\Users\Sheldon\AppData\Local\Microsoft\CardSpace\ (all files)
    C:\Users\Sheldon\AppData\Local\Temp\ (6 .tmp files)

    1. Have you tried taking ownership of those files? Sometimes programs will write files to your user profile, but the program in question was running under a different user account – for example, the system account (common for services)… thus the files it created inherited the rights of the account under which they were created. That might be why you can’t move them, even though you are the administrator.

  18. Hi,

    I’ve been using Win7 RC7100, and I’ve used the mklink command. It’s touchy, it seems, and after re-installing the OS, it isn’t as simple; I’d have to rename my user directory (From Pete to Pete_Old, for instance), let Win7 create the new one, manually create a new one on a different volume, run mklink /d, and then copy everything over from the old to the new.

    However, above and beyond that, my main question is in regards to permissions. It seems as if all the user directories on D: are “open” to whomever logs in. Even though the C:/User/Name may be locked to the individual, the D:/User/Name, to which the symbolic link points, is not. I haven’t tried playing with permissions (I haven’t been that brave yet), but any pointers as to how to rectify that situation would be helpful.

    I used the mklink /D command to create a symbolic link, and not the junction, by the way.

    Thanks

    1. I believe permissions do not propagate across symbolic links or directory junctions, so you will have to set the permissions on the destination folder manually, yourself.

  19. I thought this was my saviour, but an interesting quirk has caused me to write…
    Creating the link has stopped internet explorer downloading anything. It’s very strange. Creating a profile that is not mklinked allows internet explorer to download any file normally. Create a profile that is mklinked (J) then reboot the machine, suddenly IE8 cannot download. Any thoughts?

    1. Perhaps the profile is not moved over entirely? Or IE is trying to save downloaded files in a location that isn’t there anymore?

      1. I hit the same issue above (unable to download files through IE). Turns out this is because after the move, the files under \\AppData are owned by Administrator (assuming your logged in as the Administrator to move the files). As a result, IE is unable to write to Temporary Internet Files, which is where it stores files as it downloads them. You need to reset the ownership of \ recursively so that all the files under that location are owned by you.

        To do this, right click on \, click Properties -> Security -> Advanced -> Owner and make your username the owner of that folder and all child folders (make sure you check the box marked “Replace owner on subcontainers and objects”.).

        Following this, open IE, go to Tools -> Internet Options, and delete everything under Temporary Internet Files, History, Cookies etc. . Close and restart IE and try downloading a file. This should now work.

        1. That’s a good point – depending on how you copy the files (and where) the permissions might get changed. Always a good idea to check on them and reset them back to what they are supposed to be before you log in!

        2. This worked for me – I could not get bookmarks to save. I had already duplicated security settings and changed ownership, but it was not until I deleted the old content in IE that I could get it to save bookmarks (and I presume downloading files). Thanks everyone.

  20. I bet a lot of the problems some people are experiencing with doing it this way is because there are a couple of problems that crop up when you copy or move the user folder to the new location:

    First the owner/security settings are lost during the copy/move, but that is easily fixed by manually setting them back to the original settings.

    Second, and most important, it will not copy or move the hidden directory junctions, which will cause big problems with some applications and backward compatibility with older programs.

    That last problem is a little harder to fix because there are several hidden directory junctions throughout your user directory that you will need to manually re-create using the command prompt. It’s not impossible to to, but it takes a bit of time.

    Before you copy or move your profile directory, open a command prompt, change to your user directory and type “dir /al /s > Junctions.txt”. This will create a text file with a list of the junctions that you will need to re-create.

  21. I get this message when I try to enter the string in the command prompt

    Cannot create a file when that file already exists

    Does anyone else? Am I missing something big?

    1. A little bit more detail would be helpful. What exactly are you typing into the command prompt? Why are you typing it? What is it you’re trying to do?

      The fact that you’re getting an error means that you are missing something. Look up the instructions for the command you are using and make sure you’ve got all the parameters right.

      Don’t just blindly copy & paste some command without knowing what it’s meant to be doing, and then ask for help when it doesn’t work – have you tried to figure it out at all on your own?

      Remember, Google is your friend. Use it.

  22. yes, Google is terrific. But to actually address parsec’s question, the reason for the “Cannot create a file…” error is because the instructions are incorrect.
    Creating a link actually creates a file. Since your empty profile folder still exists in step #3, the link cannot be created. What is missing is the step where you delete the original profile folder.

    However, an easier method would be to simply move your profile folder where you want it, then create a link to it. I haven’t tested this approach because I blindly followed the guidance above, but I see no reason it wouldn’t work, and save you a step:
    [as the article states, none of these steps can be performed on your currently logged-in profile. Reboot + safemode with admin account is what I used]

    1.) Move the profile folder to your new destination:
    C:\Users\> robocopy C:\Users\UserName D:\Users\UserName /E /Z /COPYALL /MOVE

    2.) Create the link
    mklink /J C:\Users\UserName D:\DestinationDirectory\UserName

    (and yes, you can make a link to a folder that is not empty.)

  23. Part of the problem with the confusion here is that there are SO many different ways you can do this.

    – You can create a directory junction
    – You can create a hard-link
    – You can create a symbolic link
    – Or you can “mount” an entire partition to a particular folder using the Windows Disk Manager

    Each one of these can be used to achieve the same end result, but there are “gotchas!” inherent in each method.

    It’s also been a while since I’ve actually had to do this, so my memory is a bit rusty as to which “gotcha” goes with which method (I think the “empty folder” requirement applies to mounting a partition to a particular folder using the Windows Disk Manager method).

    When in doubt, consult the documentation… or Wikipedia (which actually does a good job of explaining all the different variations on NTFS reparse points, and of course contains lots of really good references to articles with more detailed information).

  24. I’m typing

    mklink /J C:\Users\UserName D:\DestinationDirectory

    on a Vista-64 computer.

    I asked this question because no one else seems to be getting this precise error, and the error itself doesn’t really seem to make sense to me.

    1. Try mike’s suggestion:

      “Creating a link actually creates a file. Since your empty profile folder still exists in step #3, the link cannot be created. What is missing is the step where you delete the original profile folder.”

    2. Or, to put it more succinctly:

      Delete the (presumably now empty) “UserName” folder from C:\Users, then run mklink /J C:\Users\UserName D:\DestinationDirectory.

      I find it helpful to run tests when in doubt – try creating a test folder on one drive, then another, and try junctioning them together, until you achieve the desired results. Then, substitute the “test” folders names for the real ones you want to junction.

      Here’s an example session I did just now to double-check my results:

      C:\>mkdir test

      C:\>k:

      K:\>mkdir test2

      K:\>c:

      C:\>mklink /J C:\test k:\test2
      Cannot create a file when that file already exists.

      C:\>mklink /D C:\test k:\test2
      Cannot create a file when that file already exists.

      C:\>mklink c:\test k:\test2
      Access is denied.

      C:\>rmdir test

      C:\>mklink /J C:\test k:\test2
      Junction created for C:\test < <===>> k:\test2

      C:\>

      I know I should update my article, but I just haven’t gotten around to it yet. Sorry.

  25. Here’s another way to do this that I’ve used since WIndows NT with zero problems. It does not use links…. strictly registry changes.

    1. Login as another administrator.
    2. Copy your existing profile to the new drive/location (ex. C:\Users\Mark -> D:\Users\Mark)
    3. Open regedit.exe and browse to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList.
    4. Find the folder that looks something like S-1-5-21-814754908-2423985534-814754908-1001 with the registry key ProfileImagePath that matches your existing account (ex. C:\Users\Mark).
    5. Change ProfileImagePath to point to your new profile location (ex. D:\Users\Mark).
    6. Logout and login to the account that you changed.
    7. Open the properties dialog on your My Documents folder (or other profile folder) and check the actual path. It should now be pointing to the new location.
    8. Almost there… stay logged in and open regedt in your account. Do a global search on C:\Users\Mark and change all instances to D:\Users\Mark.
    9. Reboot and re-login.
    10. Recheck profile path and registry paths one more time (just being anal here)
    11. Delete your old profile (C:\User\Mark)
    12. Done.

    Final Note: Under Win 7, if the “Windows Media Player Network Sharing Service” is running you may get a file in use error when attempting to delete your old profile. To fix this, simply stop the service first, delete the profile and then restart the service.

    I’ve been doing this for years and it’s completely reliable.

    1. Hi Mark,

      I thought Keithius post was excellent but a little bit ‘scary’ for me, however you approach seemed more straightforward. I followed your process and everything seems to have worked fine but I have a problem with icons in Windows Explorer continually corrupting. I can fix it by deleting the iconcache database but it keeps recurring. My suspicion is that something has gone wrong during the registry changes I made – in spite of all my careful attention! Is this something that you’ve come across?

      Thanks!

    2. Ive done this many times during a domain change and it works quite well with the exception of outlook pst files and an occassional bastard app that we dont support. Easy work around with outlook. Just point to the correct area which is normally in the user outlook folder.

  26. Thanks a bunch. It worked great for me. No problems. Using win7 enterprise and have a ton of extra progs loaded and it worked just fine. I tried a copy first and not all the files copied but the move worked great. Just logged back in and worked like buttah. Thanks Again.

    Shannon

  27. tried it, but when i log back into the account it says it is setting up a temp file for me that will be deleted when i log back off.

    my files look like this c:\users\int gds d:\users\int gods

    are those spaces fine, i tried it both ways, forgot which way said it was all good, path created BUT the problem is that when i log in, like i said, it just says it is creating temp folders!

    any suggestions

    1. Check the permissions on the new folder, and make sure you copied everything – look for “hidden and system files” – those are the only suggestions I can think of right now.

  28. I noticed in Win7 a set of junctions in the original profile folder (C:\Users\Greg). I manually recreated these in the new location (D:\Users\Greg). However, all of these manually created junctions are plainly visible whereas the original ones were hidden.

    ATTRIB doesn’t appear to be able to hide the manually created junctions, nor do the original ones have the H attribute set. So there is something else going on that identify these as special junctions (e.x. NetHood, PrintHood, Start Menu, Templates, etc).

    QUESTION: What is the process needed to set these manually created junctions to have the same characteristics as the originals?

    I couldn’t find any way to move the originals, nor do I think that would have worked.

    1. I don’t know – I don’t have ANY junctions like that in my original profile folder. So I’m not sure exactly what it is you are seeing, nevermind how to re-create “hidden” junctions.

  29. Followed the instructions above (Win7) seems to work fine untili I try to download files in IE.
    Tryed adobe reader but got error not finding adobe download site. Tryed with a user NOT moved and then it worked fine, come up with a question about installing ActiveX adobe dowloader that did not show up on the moved user.

    1. See my comment above. In short, IE no longer has write permissions to Temporary Internet Files under \ because the folder (and a bunch of its parents) are owned by Administrator. You need to reset the ownership of those folder (in fact, the easiest is to reset the entire directory hierarchy under \. Instructions a few posts above.

  30. Hi, just tried this and was succesful. I must say I made a little combination of another, very similar, method described here:
    http://www.tips5.com/how-to-relocate-user-profile-folder-to-other-drive-in-windows-7
    and added a small change myself due to some copy problems I had.

    So,
    1) Create a new admin account (with password)

    2) restart PC and hold F8 until you get option to start in safe mode. You should also see an option to repair windows. Choose that option. After a little loading time you’ll be asked to login (as the admin you just created) and get a menu.

    3) Select “Command Prompt”

    4) Use the command prompt to find out which drive letters are now associated with your Windows drive and the drive you want to move your profile to. They will be different now that you´re in repair mode!! In my case E: and D: respectively.

    5) use robocopy to copy all the files from your profile (robocopy will also copy all permissions) with this command:
    robocopy /MIR /XJ /B /R:1 /W:1 E:\Users\[Accountname] D:\Users\[Accountname]
    (the /B option will make sure that any “access denied” copies will not appear and files will be copied. This happened to me on all *.tmp files in AppData\Temp)
    Make sure that robocopy reports no failed copies (FAILED column = 0)

    6) Then remove the old profile folder with:
    rmdir /S /Q E:\Users\[Accountname]

    7) Create the Junction with:
    mklink /J E:\Users\ D:\Users\[Accountname]

    8) To verify, now go to the folder on the system drive and “dir” inside E:\Users. You will see the link made.

    9) Restart and enjoy!

    Worked like a charm for me.

    greetings
    PietPara

      1. I followed these instructions, and they did work. The key is to specify /XJ as a parameter to robocopy (else it tries to follow the junctions and ends up in recursive hell). However, with /XJ specified, the junctions which windows had created to make older programs work (ones which hardcoded links to “My Documents”, for example) will be gone. In order to preserve these, I first enumerated all the junctions in my user profile using “dir /al /s > junction_list.txt”. Then, I ran robocopy and moved the folder structure. Following this, I recreated the junctions in junction_list.txt using mklink.

        I had to also take ownership of the entire new folder hierarchy explicitly, else IE would refuse to download files (and, I’m sure, a bunch of other programs would have failed either silently or catastrophically).

        1. I don’t use RoboCopy myself, so I can’t provide any feedback or guidance on the “right” switches to use with it – so thanks for posting this comment to let people know!

        2. Hi AAkash ….tat’s pretty much true what u said ….but, since me being a novice to this jargon stuff… i need further help….can u plz put the code for how u recreated the junction point for Junction_list.txt ….and also how u took the owner ship rights of the moved “Useers” folder…

          thx

          Ashwin.

    1. Two comments to the method mentioned here. I tried using it to move the Program Files folder on my EeePC 901 (8GB + 4GB Flash) to the smaller disk — yes, it’s a separate disk, not a partition.

      1. You don’t have to create a new admin account. Just enable the existing built-in one from an elevated cmd using “NET USER Administrator * /ACTIVE:YES”. This will activate the account and the * will prompt you for a new password (no characters are echoed when you enter the password). Don’t forget to deactivate the account using “NET USER Administrator /ACTIVE:NO” once you are done. Re-enabling it can be done without the * in the command.

      2. I cannot confirm that robocopy with the options given above does copy ownership and permissions. At least not on the “Program Files” folder. The following command however does. Don’t forget to change the drive letters according to your environment… on my EeePC they were swapped.
      XCOPY /E /I /H /K /O /X “C:\Program Files” “D:\Program Files”

      /E – copy subdirectories, including empty ones
      /I – assume the destination path must be a directory
      /H – also copy hidden and system files
      /K – copy file attributes like “Archive” or “Read-Only”
      /O – copy owner and permissions (ACL)
      /X – copy auditing settings

      The first path is the source, the second path is the destination.

      3. When creating the junctions I experienced a problem. This might be related to the fact that my drive letters were swapped, instead of moved (D: and C: in recovery console == C: and D: in Windows). Anyways, when I created the junction on D: (the windows drive) using MKLINK /J “D:\Program Files” “C:\Program Files” and rebooted into Windows everything broke, because the junction was now named “C:\Program Files” and pointed to “C:\Program Files” — exactly as I specified during creation. From the instructions above I would have expected the Junction to point to “D:\Program Files”, but obviously the Junctions only remembers the drive letter, not the IDENTITY of the drive it points to. Maybe this can be fixed by creating the junction using the drive letters that are visible in Windows, in my case MKLINK /J “C:\Program Files” “C:\Program Files”… but this is untested. I can only confirm that it is possible to create junctions that point to themselves in Windows, but not how they react to changing drive letters.

      Cheers,
      Fritz

      1. That’s a very interesting situation you’ve encountered there.

        It was my understanding that directory junctions are linked by volume ID, not by drive letter, so what you’re describing shouldn’t have happened. But then again, I’ve never tried it so I wouldn’t know.

        I would try running a test – create a junction from a test folder on your C: drive to a folder on your D: drive from the recovery console, and see if, when you reboot, it really is mixing up the drive letters as you said it was. Because I really cannot believe that junctions are based on drive letters – in fact, I know they aren’t, because you can use junctions to “mount” an entire volume to a folder on another drive without the original volume even having a drive letter.

        So, I would say try a test with a sample folder instead and see what results you get – that at least might give you some clues as to what you need to do, without messing things up any further.

        1. Since I am about to do the same thing to my girlfriend’s computer I have investigated the issue at hand a little further. It seems possible to circumvent the problem by using the globally unique volume identifieres instead of drive letters to create the junctions. See this example:

          C:\>MOUNTVOL
          ...[snip]...
          \\?\Volume{cfa70646-9253-11de-89d7-806e6f6e6963}\
          D:\
          \\?\Volume{cfa70647-9253-11de-89d7-806e6f6e6963}\
          C:\


          C:\>MKLINK /J test "\\?\Volume{cfa70646-9253-11de-89d7-806e6f6e6963}\Program Files"
          Junction created for test <> \\?\Volume{cfa70646-9253-11de-89d7-806e6f6e6963}\Program Files


          C:\>DIR
          [...]
          14.08.2010 11:52 test [\\?\Volume{cfa70646-9253-11de-89d7-806e6f6e6963}\Program Files]
          [...]


          C:\>cd test


          C:\test>dir
          [shows the contents of my Program Files folder on D:\]

          Currently I have only tested this directly in Windows, not in the PE (Preinstalled Environment, accessed by pressing F8 during boot). If anything goes wrong I will report back here.

          1. Using the globally unique volume identifiers is a really clever idea to avoid mix-ups with changing drive letters, etc. Well done!

            And thanks for sharing it here!

  31. Thank for putting this info together. I found the comments very valuable as well. I was able to successfully move C:\Users to D:\Users, place a directory junction at C:\Users pointing to D:\Users, and rename C:\Users as a backup before placing the link to D:\Users. Here’s my procedure:

    Objective: Move C:\Users to D:\Users. Place a directory junction at C:\Users pointing to D:\Users so Windows does not realize the Users directory has been relocated to a different disk volume. Rename C:\Users as a backup before placing the link to D:\Users.

    Method:

    1. Create D:\Users directory and set security to match C:\Users
    2. Create two admin accounts that will be used to move data to D:\Users
    3. Boot into Windows Safe Mode to copy all data from C:\Users to D:\Users
    4. Copy all data from C:\users to D:\User. Do *not* copy directory junctions. Use admin account #1 to copy all data except data for admin account #1. Use admin account #2 to copy data for admin account #1. Windows uses directory junctions throughout the Users directory structure, and there is no known method to copy directory junctions as all data copy programs distributed with Windows copy the contents of the junction instead of the junction itself. Trying to copy the directory junctions in C:\Users will lead to a recursive loop and failure, so don’t even try it!! Use the following command to copy each directory in C:\Users to D:\Users:

    Robocopy C:\Users\[Directory] D:\Users\[Directory] /e /secfix /copyall /b /sl /xj

    This will successfully copy all data and security settings. The only remaining data not copied will be the directory junctions.

    5. Manually create junction points in D:\Users. First list all directory junctions in C:\Users and save to a file: dir /al /s C:\Users > C:\junctions.txt. Next manually create each junction in D:\Users.

    For example:
    a. cd d:\users\default
    b. mklink /J “Application Data” c:\ProgramData

    Note: You do not need to create the junction points for the admin accounts, as those are just temporary accounts used to move data to D:\Users. When this procedure is finished, you should delete the temporary admin accounts and create new accounts. Creating the directory junctions in the Default directory will ensure all new accounts get the correct junctions. On my system, I needed to create the following junctions:

    D:\Users – 1 Junction
    D:\Users\All Users – 6 Junctions
    D:\Users\Default – 16 Junctions
    D:\Users\Public – 3 Junctions

    There is also a symlink in C:\Users that needs to be in D:\Users. The robocopy command with the /sl option will correctly copy the symlink from C:\Users to D:\Users. Of course, if you have active accounts you are copying, you will need to manually create directory junctions for them as well.

    When you create the directory junctions in D:\Users, don’t worry about setting the security to match the junctions in C:\Users. The important point is to make sure all the directory junctions you create in D:\Users are set as hidden files.

    6. Now, we have successfully copied all the C:\Users data to D:\Users and manually created the junction points. We are ready to rename C:\Users to C:\Users-bak and create the junction link between C:\Users and D:\Users. The C:\Users directory is always in use, and will not allow you to rename it, so we need to boot from CD and use the recovery command shell. First, boot your system using your Windows 7 media and select “Repair Your Computer”. Next, select your Windows OS to repair and then “Command Prompt.” Once in the command shell, your C volume will be mounted on another drive letter. In my case, C: was mounted on E: and D: was still be mounted on D:. You can now rename the Users directory and create the directory junction to D:\Users:

    a. Rename E:\Users E:\Users-bak
    b. Mklink /J E:\Users D:\Users

    7. Reboot your system, remove your temporary admin accounts, and create new accounts. You’ve done it! C:\Users has been moved to D:\Users and a directory junction is in place pointing C:\Users to D:\Users. You have your original C:\Users renamed as C:\Users-bak, so you can always reference it if you forgot something or need to back out to your original configuration.

    1. I like the sound of Gary’s technique – I’m about to try it, will let you know how I get on.

      A couple of points to add:

      * adding the /q flag to the dir command will include the owner of the junction point in the file
      * the attrib command can be used to view the attributes on symlinks and junction points, and to set them as needed. Use it with the /L flag to work on the link itself, or without to work on the target of the link. You’ll probably need the /D flag too. Off the top of my head I can’t think of an easy option for combining the output of dir with attrib such that you get attributes listed in the file as well (which would be handy – no thanks to Microsoft for removing the verbose flag from dir in Win7!!!), and I’m too lazy to write up a script, so I’ll probably just iterate over the 40-odd links I have under C:\Users\ by hand.
      * Gary, you do a two-step shuffle to copy over both temp admin accounts… and then just delete them. If they’re going to be deleted why bother using the two-step to copy them in the first place? I’m going to try it as having one temp admin and my real (existing) admin – do the copy as the temp, not bother to copy the files for the temp, and then just use the real admin to cleanup when I’m done.

      I’ve also read elsewhere that moving C:\Users means Microsoft will not allow any subsequent upgrades etc. to occur, patches may not work, they’ll only provide limited (paid-for) support, etc… anyone had any experience to counter these comments? For example, has anyone successfully upgraded after moving C:\Users\ to D:\Users\ ?

      1. Your right Sam, you don’t need two admin accounts. In fact, you can do everything from the Windows recovery DOS shell so you don’t need any temporary accounts. I recently found that that you can boot into safe mode (F8 during boot) to get the Windows recovery DOS shell, so you don’t even need to boot from the Windows CD. When you are in the recovery DOS shell, no accounts are actively being used, so you can copy all account data without issue to the target location.

        One last minor point I didn’t document is that it’s a good idea to hide D:\Users so you don’t see it. This prevents duplicate data scan from applications like Windows Media Center.

      2. The TechNet article on Profile Directories (http://technet.microsoft.com/en-us/library/cc722177(WS.10).aspx ) has this “Important” note:

        This setting should be used only in a test environment. By changing the default location of the user profile directories or program data folders to a volume other than the System volume, you will not be able to service your Windows installation. Any updates, fixes, or service packs will fail to be applied to the installation. Microsoft does not recommend that you change the location of the user profile directories or program data folders.

        and follows with this Caution:

        Using this setting to redirect folders to a drive other than the system volume blocks upgrades. Using ProfilesDirectory to point to a directory that is not the system volume will block SKU upgrades and upgrades to future versions of Windows. For example if you use Windows Vista Home Premium with ProfilesDirectory set to D:\, you will not be able to upgrade to Windows Vista Ultimate or to the next version of Windows. The servicing stack does not handle cross-volume transactions, and it blocks upgrades.

        There is a workaround at http://www.windows7hacker.com/index.php/2009/08/upgrade-to-windows-7-when-the-users-profile-is-on-the-different-partition/

        If I understand this correctly, the workaround permits the updater to run, but no updates will take place within the user profiles (e.g., to AppData). That doesn’t sound safe to me.

  32. I just found out that Norton Ghost 15 has a disk copy feature. I tested a disk copy of my C: drive to an external hard disk, and it copies everything correctly, including directory junctions and security settings. This is a good option if you have a blank target disk, as you won’t have to manually create the directory junctions. You’ll just have to delete all the stuff it copies you don’t want.

    I have Norton Ghost 15 and had tried a backup/restore of the user directory, but it didn’t restore the directory junctions. Nice to know the disk copy works.

    1. Yeah, Ghost has always been a nice disk copy utility, though I don’t like having to pay for it (I use the Gparted LiveCD myself, though that’s not perfect either).

      I expect any disk copying tool would copy junctions and security settings – after all, these utilities usually do a bit-for-bit copy.

      I expect they’d have some troubles, though, if there were junctions to a different physical drive though… I can’t see any way for a disk copying utility to handle those gracefully.

  33. Hey, I had to comment, i just installed windows 7 and wanted my ‘personal’ folder to be on my second drive, i thought it must be easy so had a quick google, i soon thought it was not going to be easy then i saw this massive page talking about some crazy stuff and even reinstalling to get it changed so i thought forget it,

    I then clicked my personal folder window then selected and cut all of the folders including the desktop, and pasted then in a folder i created in my username at the root of my data drive. Done, all of the links now pertane to folders that exist on my data drive……..cant belive it coudl be so simple, i had to laugh

    I do have one slight issue i seem to have videos, pictures and music folders on my c: but they are not the My videos , My Pictures & My Music that the links point to those are definately on the data drive, i tried to delete but i said i didn’t have permission even though i am admin but i am sure i get rid of them, its just a bit untdy atm as they appear alongside all of the ‘My’ folders when i click the personal folder link – but this my just be something on my machine anyway, maybe an issue from another program.

    So to recap if you have just read all that about fixing it, JUST TRY CUT AND PASTE TO NEW LOCATION.

    Im on build 7229 x86 and it worked for me : D

    1. I have to say I’m a little skeptical – it should be impossible for you to copy your profile folder like that while you are logged in, as there are files in there that are “in use.” But perhaps Windows 7 makes better use of things like Volume Shadow Copy to allow moving in-use files; I don’t know.

      Unfortunately I don’t have Windows 7 (yet) so I can’t verify your claim – perhaps someone reading this could independently verify this? Again, I don’t mean to dismiss your claim, but it is a little hard to believe. (If it works though, then thanks for sharing!)

  34. Ok, I rebooted and then loaded the libraries page, in the properties i removed the links to the old c: locations just leaving the new data drive locations.

    When i checked back in my user folder on C:\ the 3 folders were gone (i did have a new tracing folder not sure what it is possibly MSN as i just installed it) but anyway its sorted.

    actually just checked it appears in both locations when i open MSN, not a problem though – i hope this info saves some stress and time

    Anthony

  35. You can do the same for the public libraries too, cut and paste all ‘Public’ folders from ‘Public’ Link to a new folder called public on the data drive then go to the public libraries page and add the new location for ‘recorded tv’ remove the old one and thats sorted too !

  36. Found this post today…have been doing this MKLINK trick for 2 years now.
    First with Vista and now on Windows 7

    I have had no problems, except finding out the doing it the right way 🙁
    Loging on as Administrator is my secret to succes.
    Also rebuild the exact NTFS inheritance ‘credential’ tree manually.

    PS: Did have a Creative SB driver that blew away the symbolic link. No real harm cause it can be simply re-created…but you do get scared when your profile is ‘missing’

    1. Hi, I tried this on Windows 7 Profession x64 (after a fresh reload) and it worked great. I notice now that when I go to My Documents where it is referencing C:\Users\ and search, I am getting no results from the indexed search, but if I manually go to D:\Users\, I get indexed search results. I checked the indexing options and they link to my moved profile is not available on the C: drive to add as an indexed location.

      Any advise on how to get indexed results of my docs, pics, etc, when I reference the C: drive of Library locations? Do I need to add the D: locations to my Libraries?

      1. I’m not sure why the search/indexer isn’t handling the junction correctly… however, I did find some pointers.

        The first is this thread from MSDN, and the second is this question from SuperUser.com.

        Just skimming these articles, it seems like the behavior you’re seeing is an inherent, “by design” limitation of Windows Search. But you’ll probably want to read both of those articles I just linked to for the full story.

        1. Looks like one way to work around this is to change the location tab information for your shell folders before moving your profile to the alternate location.

          So, before you begin step 1. you would go to each of your shell folders (Contacts, Desktop, Documents, etc) and go to properties, then location tab. Change the location to the new profile location (i.e. D:\Users\UserName), say Yes to Move the contents. This points Windows, and the search indexer to your new locations when click Documents on the Start menu, or other locations. After you do this, then you can start step 1 above.

  37. I found this all a little scary so did some more reading. Mark Russinovich’s article in Technet Junctions V1.05 seemed relevant.
    I notice that PietPara used mklink to create his junction. I have downloaded junction from techNet.
    Has anyone tried this?

    1. Mark Russinovich’s “junction” tool is for versions of Windows that don’t have mklink (i.e., Windows 2000, XP). But both junction and mklink do the same thing.

      Remember, the Windows NT file system (NTFS) has supported junctions all along (well, at least as far back as 2000), but Microsoft didn’t include a tool for creating junctions in Windows itself until Vista. So that’s why the “junction” tool exists.

  38. There is a minor typo in PietPara’s procedure.
    The mklink instruction is incomplete
    The line should read:
    mklink /J E:\Users\[Accountname] D:\Users\[Accountname]

    The first [accountname] was missing and the error message is not explicit, only says directory exists!

    Worked perfectly

  39. hi, all,
    I just finished all of my work with junction on a WinXP machine. Boy am I happy with the results. Two thirds of my OS drive is now available as opposed to being full before I started.
    Performance has returned and I moved 2 user accounts to places where there is plenty of room for growth. I just thought I would pass along a few tips I stumbled upon as I was doing this.
    1) Program Files folder cannot be renamed, but everything below can. This tip will become clear as you read on
    2) used xcopy to copy files to newly created folders in new space. there is an option to copy hidden and system files – /h that makes that part of the process much simpler.
    3) Once I had copied all of the data to the new folders, then I RENAMED THE FOLDERS WITHOUT HAVING TO EMPTY. this way, if something goes wrong, original data still resides in original place.
    4) next, created empty folders with original names for the junctioning.
    5) created junctions in safe mode at command prompt as Administrator.
    6) tested work. did not remove original data until junctions showed proper performance. I was able to remove all of the original folders and things work perfectly.
    created several junctions for large folders under program files. all apps are working.
    Incidentally, doing a dir command in command prompt will actually show the junctions in the list. Junction does not work with long file names and there are times when that makes a considered move not possible. Also, I have no download problems.
    Having done this, I am running a ‘new’ PC. Very,very happy with this. now have to bachup.
    Remember to back up ALL drives – too much configuration would be lost without doing this.

  40. Ive had a problem and I dont know what to do!!

    I did everything what you said but it doesnt seem to work. It keeps creating a temp account everytime i try to log in to my main account.

    Then when I click on My Computer > users

    It has the shortcut there with my username but when I click on it it says

    Location not available

    C:\Users\Nicole

    The Device Is Not Ready

    But when I got into the actual external hardrive file .. I am able to access the folder and files

    OS – Vista

    1. I would not use an external (removable) hard drive!

      Also, you may have to check the permissions – see previous comments. Easiest way to do this is to compare against a “normal” user profile and make the permissions match.

        1. If you don’t know what that means, then I would not have tried to do this.

          My recommendation to you is to put things back the way they were (as best you can) and not try again – at least until you can understand the conversation that’s been going on in these comments. Otherwise, you’ll just end up in the same situation again.

          1. Ok thanks

            Well I emailed you about putting everything back to how it was. And also if you could give me info on how to use my external hardrive? for personal files and folders so that windows regonises where they are

  41. This has been a most useful thread, but even after recreating the junctions not all works. I just completed another reinstall and another attempt to move my user accounts to a second drive. This time I first detailed the attributes of each junction AND the security permissions and owner for each junction. (owner is SYSTEM for all of them).

    It’s been only one week, but so far all seems to work. Thanks for your pioneering efforts.

  42. Very interesting topic.
    Thanks for sharing the ideas.
    U guys are really rocking.

  43. This worked great for me – it was the simplest, least destructive method for moving existing user profile directories that I found. Thanks for the time spent helping others.

    1. You’re very welcome! I’m glad it worked out for you. It would be nicer if it was easier to do in the first place, but still… I’m glad you found this useful!

  44. I have windows 7 running on an ssd so I decided to try this to alleviate a bunch of space on the ssd. The ssd is “C:” and I planned to move to a hdd “F:” I created temp account as admin, rebooted into safe mode created users folder on F within users i created folder “darren – new” and then renamed original profile folder “darren – old”, i made windows show me hidden files, and proceeded to move everything and it went well with no prompts or errors. (Now the fun part) I opened up cmd clicked run as admin and typed: “mklink /j c:\users\darren – old f:\users\darren – new” but when i hit enter cmd snaps back with “the syntax of the command is incorrect” whats that mean and how to i complete the junction? Thanks in advance!

    1. You probably need to put quotes around your paths, since they contain spaces; e.g. “c:\users\darren – old” instead of just c:\users\darren – old.

      1. ok i tried that and now it says “cannot create a file when that file already exists.” so i tried renaming the folders again this time to darren.old and darren.new and tried it again without the quotes and i got the same message

        1. I believe if you read through the other comments on this page you’ll find the answer to your question. Specifically: if a folder with the same name as the link you are trying to create already exists, you can’t create a link. So, in this case, based on the command you said you were trying to run, this means that the “C:\Users\Darren – Old” folder exists, and that’s why you can’t create a link there with the same name as it.

          Further, wouldn’t you actually be trying to create a link from “C:\Users\Darren” to “F:\Users\Darren – New”, and not from “C:\Users\Darren – Old” to “F:\Users\Darren – New”?

          In this case, the command you’d want to run is:

          mklink /j “c:\users\darren” “f:\users\darren – new”

          Instead of:

          mklink /j “c:\users\darren – old” “f:\users\darren – new”

          Because you’re trying to make a junction from C:\Users\Darren -> F:\Users\Darren – New. The “Darren – Old” folder is just there as a backup of your profile in case something goes horribly wrong.

  45. I am trying to get this work on Windows 7. I have moved all files (including the hidden file)
    But when I open the command prompt and list the directory using dir /a, I see a few files.
    NTUSER.dat
    ntuser.dat.log1
    ntuser.dat.log2
    ntuser.dat{}.TM.blf
    ntuser.dat{}.TMContainer000…001.regtrans-ms
    ntuser.dat{}.TMContainer000…002.regtrans-ms
    ntuser.ini

    and some junction points such as Application Data, etc

    I created the junction points in the target user profile, But am having difficult time move the files.
    I have tried it in Safe Mode (Command prompt), have tried taken the ownership, have tried changing the attributes.

    Move, Del, copy commands simply are unable to find files (however, opening them in notepad works,binary).

    Does somebody has an idea of what is going on and how to circumnavigate?

    Thanks

    Faisal

    1. These files are always locked whenever you are logged in to that account – even in Safe Mode (Command Prompt). You CANNOT move them while you are logged in under that account.

      That’s why you need to either move them while logged in under a completely different user account (which is what I typically do), or via the command prompt you get via the Install CD (as others have noted in the comments here).

  46. Funny you mentioned Linux, as it’s no much easier in that – change the home dir path once in one file, copy with a sudo and pretty much done. No need to reboot in safe mode or any other nonsense either.

    1. Yeah, I know, Linux has always had a simple, easy way to move pretty much anything around – unlike Windows. Heck, for a long time, Windows user profiles were actually kept in a subdirectory of the WINDOWS folder itself!!

  47. Help! so I created an admin acct. I moved my profile folder to D:\Users\Jay. I deleted my old profile folder and created a symbolic link mklink /D C:\Users\Jay D:\Users\Jay.

    Now when I login to my account it says it has created a temporary profile for me and that all files in this profile will be deleted when I logout! What did I do wrong? When you look in C:\Users there is only a symbolic link to my profile on D and nothing else. If you click on that link it works. I changed the ownership back to my Jay acct after moving everything as Administrator as well.

    Thank you,
    Jay

    1. You may not have copied everything in you user profile to D:\Users\Jay – for example, there may have been hidden files you didn’t copy.

      It may also be that you created a symbolic link (mklink /D) instead of a directory junction (mklink /J), and you probably needed to create a directory junction in order for this to work properly.

      Also, you probably shouldn’t have deleted your original profile folder – I would have renamed it (in case something went wrong, so you could go back).

      Try putting your profile back in the original location (get rid of the symbolic link) and see if you can log in normally without getting the temporary profile message. If you can do this, then you did copy all the files right, and it’s probably just that you should have used a directory junction instead of a symbolic link. If, however, you get the temporary profile message, then that means you missed some important file when copying your user profile, and since you deleted your original profile, you are out of luck and I’m afraid there’s nothing you can do but create a new user profile, copy your user data back bit by bit and try again. Sorry!

  48. I made a batch file to move user profiles. There is no error checking…feel free to improve.

    [code]
    rem Run as administrator, NOT logged into the profile you want to move
    rem Set the 3 variables below to the proper settings.

    rem DRVLET is the drive letter where the current profile is stored, usually c:
    set DRVLET=C:

    rem PROFNAME is the name of the folder where your profile is stored, usually the same as your username
    set PROFNAME=test

    rem NEWPROFLOC is the where you want the profile to be moved. Trailing backslash not needed.
    rem Final location will be %NEWPROFLOC%\%PROFNAME%
    rem NEWPROFLOC=M:\Users, PROFNAME=test Location->M:\Users\test
    rem NEWPROFLOC=M: , PROFNAME=test Location->M:\test
    set NEWPROFLOC=M:\Users

    SETLOCAL ENABLEEXTENSIONS

    md “%NEWPROFLOC%”

    robocopy “%DRVLET%\Users\%PROFNAME%” “%NEWPROFLOC%\%PROFNAME%” /E /COPYALL /FFT /V /XJ /ZB /R:1 /W:1

    CD /d “%NEWPROFLOC%\%PROFNAME%”

    mklink /d /j “Application Data” “%DRVLET%\Users\%PROFNAME%\AppData\Roaming”
    mklink /d /j “Cookies” “%DRVLET%\Users\%PROFNAME%\AppData\Roaming\Microsoft\Windows\Cookies”
    mklink /d /j “Local Settings” “%DRVLET%\Users\%PROFNAME%\AppData\Local”
    mklink /d /j “My Documents” “%DRVLET%\Users\%PROFNAME%\Documents”
    mklink /d /j “NetHood” “%DRVLET%\Users\%PROFNAME%\AppData\Roaming\Microsoft\Windows\Network Shortcuts”
    mklink /d /j “PrintHood” “%DRVLET%\Users\%PROFNAME%\AppData\Roaming\Microsoft\Windows\Printer Shortcuts”
    mklink /d /j “Recent” “%DRVLET%\Users\%PROFNAME%\AppData\Roaming\Microsoft\Windows\Recent”
    mklink /d /j “SendTo” “%DRVLET%\Users\%PROFNAME%\AppData\Roaming\Microsoft\Windows\SendTo”
    mklink /d /j “Start Menu” “%DRVLET%\Users\%PROFNAME%\AppData\Roaming\Microsoft\Windows\Start Menu”
    mklink /d /j “Templates” “%DRVLET%\Users\%PROFNAME%\AppData\Roaming\Microsoft\Windows\Templates”
    mklink /d /j “Appdata\Local\Application Data” “%DRVLET%\Users\%PROFNAME%\AppData\Local”
    mklink /d /j “Appdata\Local\History” “%DRVLET%\Users\%PROFNAME%\AppData\Local\Microsoft\Windows\History”
    mklink /d /j “Appdata\Local\Temporary Internet Files” “%DRVLET%\Users\%PROFNAME%\AppData\Local\Microsoft\Windows\Temporary Internet Files”
    mklink /d /j “Documents\My Music” “%DRVLET%\Users\%PROFNAME%\Music”
    mklink /d /j “Documents\My Pictures” “%DRVLET%\Users\%PROFNAME%\Pictures”
    mklink /d /j “Documents\My Videos” “%DRVLET%\Users\%PROFNAME%\Videos”

    attrib /l +s +h +i “Application Data”
    attrib /l +s +h +i “Cookies”
    attrib /l +s +h +i “Local Settings”
    attrib /l +s +h +i “My Documents”
    attrib /l +s +h +i “NetHood”
    attrib /l +s +h +i “PrintHood”
    attrib /l +s +h +i “Recent”
    attrib /l +s +h +i “SendTo”
    attrib /l +s +h +i “Start Menu”
    attrib /l +s +h +i “Templates”
    attrib /l +s +h +i “Appdata\Local\Application Data”
    attrib /l +s +h +i “Appdata\Local\History”
    attrib /l +s +h +i “Appdata\Local\Temporary Internet Files”
    attrib /l +s +h +i “Documents\My Music”
    attrib /l +s +h +i “Documents\My Pictures”
    attrib /l +s +h +i “Documents\My Videos”

    cd /d “%DRVLET%\Users”
    rem You can delete %PROFNAME%.orig after you verify everything is OK
    move “%PROFNAME%” “%PROFNAME%.orig”

    mklink /d /j “%PROFNAME%” “%NEWPROFLOC%\%PROFNAME%”
    [/code]

    1. Wow, that’s a very… thorough batch file!

      It’s probably worth explicitly noting (for those people who don’t read the batch file before blindly downloading it and running it) that you need to do 3 things before using this batch file.

      1. Set the environment variables mentioned in the batch file
      2. Make sure you have robocopy and that you can run it from a command line
      3. Log in to a DIFFERENT user account (one with admin privileges) and run the batch file “as administrator”

      Thanks for sharing it, I’m sure it will help lots of people!

    2. Thanks Dave for the batch file. Worked like a charm. Thanks Keithius for starting the ball rolling on this. Typical Microsoft not to have a simple remedy for something like this.

      Cheers

  49. Hi, Keith. I’ve bookmarked this page and refer to it often. Thanks for posting and hosting this lively discussion. I’m banging my head against a wall trying to resolve the IE issue (can’t view source, can’t install Flash, images saved as bitmaps, etc.) on my work laptop. I’ve tried everything mentioned here. My latest attempt was to store temporary files completely outside my user directory (D:\TEMP\Temporary Internet Files). Alas, no luck. Any other suggestions?

    Side note: I just installed Windows 7 on my netbook, and I gave Dave’s batch file a go. That seems to have prevented the IE issue.

  50. I used Keith’s method and it worked, but now when i tried to log into the new profile, i get this error message: The Group Policy Client service failed the logon. What should I do?

  51. Thank you SO much for this! It is awesome and easy to use.

    Just a note: I am running Win 7 Pro (x64). I didn’t log in via safe mode or command console. When I moved my folder, I was told I couldn’t move some files because they were being used by certain services. By stopping the services manually I was able to move the files then without a problem.

    To stop the services:
    Click Start and type in “services”. Select the Services from the list of programs. find the service that you want to stop and then click “stop” on the left.
    Once the service is stopped, click “Try Again” on the copy/move error box and if you closed the correct service, it should continue processing.

  52. excellent solution. there are few so good technical articles as this one. everybody wants to give advice, but few have the knowledge.

    I’ll have to read your other blogs -)

  53. Keith, thank you! I finally got around to doing this on my weeks old Windows 7 installation on my laptop. Prior to doing this I had a convoluted method of keeping my data and downloads on another hard drive, and using Windows Explorer was always such a pain. The only issue I’m still having is that for some reason Windows keeps creating a second “My Documents” folder under my user profile. It’s not a day-ruiner, but it is inconvenient. Have you run into that before? Any ideas what might be causing it and/or how I can fix it?

  54. I am on a Windows 7 x64 box and under the built-in Admin account, tried the script method. Everything seemed to work, except for the IE download issue. I have knowledge of OSs, so it wasn’t a problem for me to reset the owner/security on all subfolders under my User, but IE still can’t download anything. Anyone got any ideas on this? If I’m the owner and have “full rights” on everythin folder under my username, why can’t IE download?

    1. Sorry, I’m drawing a blank – I can’t think of anything.

      You might try asking your question over on SuperUser.com; they have a much larger community of people and might actually be able to help you (certainly faster than you’d probably get an answer here; these are just comments, not a forum).

      Good luck!

    2. Not sure if you have resolved the issue or not. I’m also running Windows 7 x64 and I don’t have the IE download issue (I don’t use IE, but I tested it and it seemed okay)

  55. I used the batch posted by Dave and it worked perfectly for me. The only thing I’d add is that if you’re running Windows 7, you need to stop the Windows Media Player Network Sharing Service, otherwise the original profile folder cannot be deleted and thus the junction creation step will fail.

  56. So, i am going to give the script a go on my new Win7 box this weekend.

    I have one quick question though…i want my users data AND program files (i.e., all non OS-specific files) to be stored on a second drive (D:). What’s the easiest way to do this? Use same instructions as I am for profiles? I did read the entire thread and there are a few comments on moving the program files directory, but I didnt get a good feeling that their attempts were successful.

    Thanks

    1. No, generally speaking you can’t move the Program Files folder, at least not without great difficulty and some serious trickery. And even then, sometimes programs will just access C:\Program Files no matter what you’ve done.

      The best bet for dealing with this is simply to install your programs onto a second drive – that is, during the installation/setup of the program, change the install directory. 99% of programs allow you to do this, and that should take the bulk of programs off your boot drive. It’s not a 100% fool-proof solution, but it’s really the best you can hope for given the other limitations.

      Though of course you are welcome to try and “beat the system” so to speak, but be warned that you may be in for a very, very rough ride!

      1. Ok thanks. I’m pretty computer savvy but I’m not going to risk screwing something up, even if I do have a backup/image handy.

        Thanks again Keithius

  57. I wrote a script to do all Windows modification before account creation.

    You can read this post, in english:
    http://www.sevenforums.com/tutorials/117308-user-folders-moving-user-folders-modular-script.html#post1008268

    Or th original one, in french:
    http://www.forum-seven.com/forum/topic4073.html

    or download the script directly:
    http://www.gopc.be/Alain/PositionDefaultFolderModular-ML.rar

    My script create the correct junctions… ten second to run, and it’s all
    You must test it!

      1. No, not quite. BrianWilder’s method is the more “official” method of redirecting your user profile to a different location – but of course you have to do it during installation of Windows itself, so it is no good after the fact. The method of using an “answer file” to do certain things during Windows installation that aren’t possible once the installation itself is done isn’t actually a new idea or a new feature in Windows 7 – it’s been around for quite a while.

        But BrianWilder’s method is not the same one I wrote about, or what most people here are talking about. It’s a cool and useful method, sure, but again, you have to do it while installing Windows – once installation is done, you’re out of luck and you’d have to resort to techniques like those discussed here.

        But thanks for pointing it out so people know about it!

  58. I felt the need to comment even if not adding anything further to the discussion: In the past I just ignored the User designation in Windows and just plunked my data willy nilly relying on my carbon based memory to keep abreast of the location and size of the aggregate. Having just received a Win7 machine with a huge vacant partition that seemed to cry out for establishing a beach head for the inevitable growth that storage of media files need…well, my search lead me here. Thanks. I’m glad that my suspicions that it wouldn’t be a simple matter of drag and drop were borne out in a vague, “Nice to see people helping the community.” — way.

    1. I’m glad that my suspicions that it wouldn’t be a simple matter of drag and drop were borne out in a vague, “Nice to see people helping the community.” — way.

      Errr… you’re welcome, I think?

      At the very least I’m glad this was able to help you. I hope it works out well for you!

  59. @Dave

    Thanks, man! Great batch. Worked like a charm. I have a few questions and a request:

    1) I’m wondering if this can be done with the program data also (or even other files)?

    2) Is there any harm in doing this to said files?

    3) I’m working with a 32 gig SSD. I’d like to keep the overhead down. It seems after the page file, I have about 2 gigs left. Any links to helping keep the OS slim would be much appreciated!

  60. I happened to use official method of relocating each folder in my user profile to D:\ but I knew that the AppData with lots of setting were left in C: when I reinstall Windows 7. Just tried out this method today, works great. Thanks Keithius. Only one small problem I see is search index works for my already located folders, but my user folder in explorer (above the Computer, below Homegroup) show a duplicate of all folders (Contact, Desktop, Downloads, Favorite,….). These folders are identical, point to the same one in my D:\. Anyone encounter the same problem. I’m thinking of remove the junction and redo this method without relocating first (I guess search index would not work that way). Anyway thanks for a wonderful article.

  61. I just got a new HP laptop. Suprised to find that HP used all four primary partitions and I am new to Windows7 and know nothing about dynamic drives and such. So I deleted HP_Recovery partition. This gives me option to put another OS on the little space I have left.

    Q. HP_Tools partition is on E:\.
    HP (and others on web) say that the laptop will not run if I delete this partition. If I move it to another partition and rename all in the registry of E:\ to somewhere else…say F:\, shouldn’t it work?

    I am going to test Dave’s batch file on a temp account and see how well it works. I’m tempted to go the registry method that Mark outlined but I am a little ‘scared’ about the unknown. I don’t want to brick my computer.

    This has been a nice find, good stuff.

    1. It may work, or it may not. It depends entirely on being able to 1) find all of the references to E:\ and change them to F:\ and 2) make those changes without breaking the computer while you’re using it.

      In theory, yes, what you proposed should work, but it’s pretty ambitious and without more knowledge about what is using this E:\ partition, I’d be hesitant to try it out on a live system.

  62. Now this will increase the lifetime of my SSD a bunch since many programs and games write to the user account these days, (firefox for one) thanks alot 🙂 Wish the installer lets one pick a custom partion for UsersFolder with Windows 8 next.

  63. Does anyone know that relocating user profiles(not user profile folders) under Windows 7 will break the UAC virtualization (fle/rgistry virtualization)?

    1. There are methods in the comments here that work around that problem, or at least as I understand it. I’m not sure what you mean by “user profiles” but “not user profile folders.”

      1. Relocate “user profiles” means to relocate the entire user profiles directory (C:\Users) to other volume. After you relocate the user profiles, there will be no more C:\Users.

        Relocate “user profile folders” means to relocate one user’s profile folder(s), such as My Documents, My Music, etc. After you relocate some user profile folders, the C:\Users is still there, just some user profile folders were moved.

        I know how to relocate the “user profiles” and know how to relocate the “user profile folders”, just want to know if anyone ran into a situation that the UAC virtualization is totally off after you relocate the “user profiles”? (If you only relocate some user profile folders, the UAC virtualization still works).

        1. Folder virtualization is a sticky point for doing this sort of thing. If you remove the entire users directory, then virtualization will break, unless you re-create the directory junctions that were used to do the virtualization in the first place.

          If you just move a single user’s folder, then virtualization will probably still work, as most of the virtualization is aimed at turning references to “C:\Documents and Settings” to “C:\Users,” since after that things are generally the same.

          You can also type “dir /al /s” from the C:\Users folder to see all directory junctions. If any of them are in the folder you’re planning to relocate, then virtualization will break (at least partially). You may be able to re-create them, if you’re clever.

          You may want to head over to superuser.com for more on advanced topics like this – these comments aren’t very active and aren’t really suited for asking questions of other people (aside from me, since I see everything).

          1. You could do the following to restore them:

            mklink /J “D:\users\\Application Data” “D:\Users\\AppData\Roaming”
            mklink /J “D:\users\\Cookies” “D:\Users\\AppData\Roaming\Microsoft\Windows\Cookies”
            mklink /J “D:\users\\Local Settings” “D:\Users\\AppData\Local”
            mklink /J “D:\users\\My Documents” “D:\Users\\Documents”
            mklink /J “D:\users\\NetHood” “D:\Users\\AppData\Roaming\Microsoft\Windows\Network Shortcuts”
            mklink /J “D:\users\\PrintHood” “D:\Users\\AppData\Roaming\Microsoft\Windows\Printer Shortcuts”
            mklink /J “D:\users\\Recent” “D:\Users\\AppData\Roaming\Microsoft\Windows\Recent”
            mklink /J “D:\users\\SendTo” “D:\Users\\AppData\Roaming\Microsoft\Windows\SendTo”
            mklink /J “D:\users\\Start Menu” “D:\Users\\AppData\Roaming\Microsoft\Windows\Start Menu”
            mklink /J “D:\users\\Templates” “D:\Users\\AppData\Roaming\Microsoft\Windows\Templates”
            mklink /J “D:\users\\Documents\My Music” “D:\Users\\Music”
            mklink /J “D:\users\\Documents\My Pictures” “D:\Users\\Pictures”
            mklink /J “D:\users\\Documents\My Videos” “D:\Users\\Videos”

  64. Woe is me. I hope someone (…or many someones) is/are still watching this thread.

    I tried Dave’s script (on Win 7 HP) like so;
    1. Created a tempAdmin account
    2. Booted into safe mode to avoid unwanted services running
    3. Logged into tempAdmin
    4. Checked the script one last time and ran it.

    After it ran, I noticed that the original C:\users\username was still there, so I tried to do the MOVE command manually – it complained that it couldn’t be moved since the process was being used. Dummy me realized it was the text file of the script I left open (opened it from the original user folder). I don’t think this should have affected the Robocopy, so I closed it, changed \uname to uname.orig and then manually created the junction. That worked so I figured I was set.

    5. Shut down
    6. Powered on, logged in as wife (it’s her laptop/ her account I’m trying this on)
    7. Poking around I noticed that Windows has re-created her user name under C:\users along with all the files, but each file and folder directly under her user folder has the lock icon beside it.

    My understanding is that these are permission restrictions which doesn’t make much sense since it looks as though administrators still have full control over this folder. But worse, why were they all recreated? Is this something to do with the junction between c:\users\Uname and d:\users\Uname?

    What did I miss?

    Thanks for any help.

  65. I used your method for almost a year now, since I started running a 64SSD and love it. Just updated Win7 service PK, now my profile will not start up. Win7 is creating a temp profile. Checked and my profile short cut and it is still in the C Drive. All files/folders still in my other drive. Done some checking and see that updates do cause some issues with this method. Some suggest that update while logged into another admin account. unfortantely my last usabled restore point is six months past. Not sure if I should just start a new profile and copy my profile to this new one or is there an easier way to fix this problem.

    Tom

  66. Is it possible to use this method to move the entire users folder, and can this method also be used for the Program files? Eventually I would like my drives to look something like this (other than C:\ the letters might be different):

    C: Windows 7
    D: Users
    E: Program Files
    F: Games

    All these will be on one drive, whilst my documents, music, etc will be on a different drive?

    1. It is possible, as other people have noted here in the comments… but generally speaking, relocating the ENTIRE “Users” folder is not something I would recommend.

      I don’t think it is possible to redirect the entire “Program Files” folder – you can redirect individual programs easily enough, but moving the entire folder – as with the “Users” folder – can be extraordinarily difficult. I certainly wouldn’t try it.

      If you want your files and folders to be partitioned in this way, you might want to look into changing the default location of these folders during the Windows installation, as you have a better chance of properly redirecting the folders during setup than you do after the fact.

      1. it is possible to move Program Files. better yet, we use c:\program files only as a mount point on our Win XP box and program files folder lives on separate HD (you can see the unix analogy right where /usr is merely a mount point to separate partition). Check out mounting under windows. just do xcopy of the stuff so you dont mess the access rights.

        1. Sure it’s *possible* but it’s terribly difficult. Something in the Program Files folder is almost always in use if you are booted into Windows, and going beyond that and using a WinPE CD or something like that is far beyond what I was willing to try to describe. But yes, technically speaking, it can be done… it’s just really, really, really hard (or if you prefer, substitute “hard” with “annoying”).

  67. I have managed to move multiple user profiles using this method in Win7. Is it possible to use the same method in a server? Or is there another way?

    Regards,

    A

    1. It depends on what server you’re talking about. But in general, the Windows servers can use the same methods described here.

      1. I am trying this in Windows Multipoint Server 2011, but I keep having issues when moving — it doesn’t always do as I say. So I have to move each folder individually, but that doesn’t seem to do the trick either.

        1. “doesn’t always do as I say?” That’s a very strange way to put it.

          You should probably head over to superuser.com – search there for similar problems, and if you can’t find an answer, ask them. There are FAR more people with more knowledge over there than here. (I’ve never even heard of “Multipoint Server” before!)

          1. Apparently, WMS hasn’t been fully discovered/explored, yet. (I couldn’t find anything!)

            Well, I had had many failed attempts, so I had to delete those users and recreate them. Finally, after numerous tries, I managed to move all the subdirectories using Robocopy.
            Now, the question is: Do I have to recreated the junctions I had previously created for the new (recreated) or will they still be referencing the same directory, as long as the name is still the same?

            Thanks.

          2. I don’t know for sure; did you try asking on superuser.com?

            My guess would be you’d need to recreate the junctions. I’m pretty sure they are tied to the particular directory entry in the master file table or some such similar thing, and not to the “name” of the directory.

            As an example, I found this answer over on superuser.com to a question asking the difference between hard links, symbolic links, and junctions:

            Junctions & symbolic links can be “broken” – it you rename/move the target, then they will point to non existent target. So you need to update they in such cases. But hardlinked files can be renamed/moved and all hardlinks will still be the same file, just with different names.

            This would seem to confirm my hunch that if you had deleted the users’ folders and re-created them, then you will need to re-create the junctions (even though the names are the same).

  68. This is brilliant! Why weren’t we doing this all along? So many messy tutorials on the web about how to (not quite) move a profile. Surely it would be easy to move the Users/docsnsettings dir if you could do it from UBCD? Haven’t tried that myself.

    1. My guess would be, as with a lot of things in Windows, this wasn’t really possible all along because of Microsoft’s business decision to sacrifice customizability (e.g., the ability to re-locate user profile folders) in favor of ease of use for very novice users.

      While those of us who aren’t “total n00bs” may lament this decision, it did 1) make Microsoft a lot of money 2) make Windows the predominant operating system in the world. So you can’t really blame them for that one.

      Of course it goes without saying that Linux (and other Unix-like OSes) have had this kind of capability since the very beginning.

      Really of course it comes down to the decision in DOS to assign drive volumes to letters of the alphabet (which I believe was done to remain compatible with CP/M’s OS, which DOS was originally aimed at being a replacement for). Because of this “drive volumes = letters” scheme, as opposed to Unix/Linux “mount points” scheme, we’ve been stuck with the inability to split things across drives or relocate certain core OS folders easily.

      Ah well, hindsight is always 20/20, and all that.

  69. Hey,

    um, what to do if your pinky finger accidentally hits the return key while typing and it creates the junction in the wrong place? (I’ve got a friend who did it – yeah, that’s the ticket…)

    David

  70. I managed to move everything and create the link just fine.. However, when I logged back on as me, Windows created a TEMP profile for me. It referred me to the event log which just said that my profile couldnt be found or was corrupted. I’ve checked the link, names etc.. Any ideas??

    Thanks

      1. Hello again,

        I dont pretend to be an expert on Windows security (I have read the first paragraph), but to test whether it was a security thing, I gave “EVERYONE” full Control on my moved profile folder. I got the same result so I dont think it’s security? I checked the ownership, that was correct. What permissions does the link itself need??
        My normal account has administrator access anyway. I’m using Windows 7 home premium. I’m trying to move the folder to a different partition on the same HDD. Are user accounts case sensitive, intolerant to trailing zeroes?? although I have checked all that… I’m at a loss but I’d like to persevere as it’s such a neat solution if it works.. Many Thanks Steve

        1. I don’t think it’s a security issue. It would just deny you access, rather than make your account temporary.

          – Did you use another administrative account to move the profile of your main admin account?

          – It might be the method you used to move the folder. Are you sure -all- the files were moved, including all hidden files?
          I had the same issue when I simply moved all the folders to the second partition. Some would disappear once moved, so I used Robocopy. Robocopy will move all folders within the user profile folder, then delete it once everything has been moved.

        2. I only mention the security issue because it is one of the easier-to-fix potential causes. If Windows can’t read the important bits of your user profile (ntuser.dat, for example) for ANy reason, it doesn’t give an error per-se like you’d expect it to, it just creates a “temporary” profile and loads that. It’s kind of weird. (It happened to me when I first tried this.)

          The other thing to check of course is that you did copy those important files – including that ntuser.dat file I mentioned (there are others as well but I forget their names).

          Since the event log says the profile couldn’t be found or was corrupted, I’d really start there with my checking.

          For the “can’t be found” problem, make sure that in the C:\Users folder, there is a folder (or directory junction, which leads to a folder containing a user profile) that matches exactly your user name. Also make sure your junction is set to the right folder depth – for example, if your user profile folder was originally “C:\Users\Steve,” make sure that the new junction is called “Steve” so that if you browse to C:\Users\Steve, you see exactly the same thing you saw before you moved your profile.

          Also, make sure the “special” user profile files are there – these files are typically have both the “hidden” and “system” attributes, so watch out for that.

          For the corrupted thing, I’d start by again checking for those “special” user profile files. Did you make a backup copy of your user profile somewhere? Try comparing the original backup copy to the one you’ve junctioned to.

          I don’t know if the folder names are case sensitive, but I wouldn’t risk it.

          As for the “trailing zeros,” I’m not at all sure what you mean by that. The names MUST match exactly – if your user name is “Steve” then your user profile folder will most likely need to be “Steve” (and after you’ve moved it, the junction you create will need to be named “Steve” as well).

          This can get somewhat confusing if your computer has joined or left a domain, and you’ve added or removed users, or if you have a user on the domain with the same name as a local user (e.g., the Administrator account)… because then you get user profile folders that start with the user name, then have a period and the domain (or computer name, depending on which one came first), e.g., “Steve.DOMAIN” or “Steve.COMPUTERNAME”. But, I’ll assume for the sake of simplicity that you don’t have that particular problem… just putting it out there for the sake of completeness.

          Also, don’t forget that you can ask a question about trouble you’re having at the site superuser.com – you will often get an answer faster than you will here, and you’ll likely get several answers, which are almost guaranteed to be more useful than my rambling replies! Anyone can ask a question there, you don’t even need an account. Trust me – it’s a really great resource (I’ve used it myself several times).

          Anyway, this has gone on long enough… but I hope it was in some small way helpful to you!

  71. Thanks so much for this; I heard about it a while back (from an uber-Linux fanatic friend) but didn’t think about it until today, when I was desperately looking for a way to create more space on my C partition.

    @Steve – I don’t know if you’ve found the solution yet, but it sounds an awful lot like a corrupted user profile/SID, related to manually removing a profile. MS recommends doing so via the Advanced Settings, User Profiles, Delete Profile option.

    Here’s the documentation on how to fix this, however (again, assuming this is your issue):

    http://support.microsoft.com/kb/947215

  72. Has anyone tried this for workgroup to domain migrations?
    My laptop moves around several domains, and instead of trying to save all my stuff in ‘Public’ and creating a new user profile every time I need to join another domain, I’d like to find a way to redirect ALL of the profiles to the same profile folder.
    Perhaps junctions are a way to do this, but I’d like to hear if someone else has tried this before attempting it with my work laptop.
    Alternatively, is there a way to join a domain without adding a new profile???

    1. That I don’t think is possible. When you join a domain, even if the user name is the same as your own computer’s local machine user account, you get a different profile.

      Every user account on every different domain is a different account, even if the names are the same. So I don’t think there’s any way to join them together.

      As for the the “Public” folder… if you mean the Public/All Users folder that comes by default with Windows, well, that always is in the same place no matter what account you’re logged in as. So you shouldn’t need to move that.

      If you’re using Windows 7 (and these days I tend to say, if you’re not, why aren’t you?) you can just add the public folder to your libraries (assuming it’s not already there). Much easier to manage than junctions.

  73. I guess what I’d ultimately like to do is use a single profile, and authenticate as a member of multiple domains without switching desktop, files, prefs, etc.

    Joining a domain creates a new profile folder (“C:\Users\Username.domainName”). If the only thing that changes (when joining a domain) is the profile folder, then it should be possible to have “C:\Users\Username” and “C:\Users\Username.domainName” both resolving to the same folder in the filesystem. This is what I’d like to do with junctions.

    Does anyone know what registry keys are added/changed to authenticate a user for a domain? If these just accumulate for each new domain, then what I’m proposing should be possible However if there are keys that must have a single exclusive domain registration, then it can’t be done.

    Ideas & comments welcome…

    1. I think you are going to find that it is far more complicated than just a few registry keys… there’s a whole bunch of authentication stuff that goes on behind the scenes that would make trying to combine profiles via junctions very difficult (I might even go so far as to say nigh-impossible).

      You might want to ask this question over on superuser.com – there are far more experts there than read my little blog.

Comments are closed.