How to Move your Windows User Profile to another Drive
IMPORTANT NOTE: A lot of people seem to run into trouble trying to do this, and can’t seem to understand where they went wrong. Please understand that everyone’s situation is a little bit different, and I can’t list every possible step that everyone, under every possible circumstance, would need to perform. At the very least, you need to be a little bit self-sufficient here – if you don’t “get” junctions and file-system-level redirecting, if you don’t understand why you might need to reset permissions on your user profile folder after you move it (or how to do that), or if you don’t understand how to copy your user profile in its entirety (hidden and system files included), then perhaps you shouldn’t try to use this method. After all, we are talking about moving your user profile here – and if you don’t know what you’re doing, you can end up with a big mess. You have been warned!
Lately I’ve seen a lot of posts about various ways to move your Windows user profile (or various parts of it) to another drive or location.
Some of these posts suggest using the “Microsoft-approved” method of right-clicking certain folders in your user profile directory (“My Documents” if you’re using XP, and “Documents,” “Music,” “Videos,” and “Pictures” if you’re using Vista or Windows 7) and selecting “Properties” and using the options there to change the default location of those folders (some posts suggest editing the registry directly rather than using the UI).
Above: the “Microsoft-Approved” way to change special folder locations.
Other posts suggest using an unattended install of Windows, which can allow you to set the user profile directory that Windows will use to something other than the default.
I’ve found these methods to be less then optimal, for several reasons:
- The “Microsoft-approved” method will certainly move your folders, but some programs just blindly assume where your user profile is and will write to the original default directory, ignoring the fact that you’ve changed it.
- You can’t move your whole profile with this method – only certain folders within it. (For example, you can’t move your “Application Data” or “AppData” folders using this method.)
- The unattended install method of course means re-installing Windows (and is not for the technically faint-of-heart).
I have talked about my method for moving my user profile before, but I think it bears repeating.
My user profile was getting very large – as in, really, really large. I was running out of space on my C: drive, and I had a 2nd hard drive onto which I could move things, but I didn’t want to move things piecemeal – I wanted the whole kit & kaboodle. I didn’t just want my documents, videos, music, and pictures moved – I also wanted my ISO images, virtual machine hard drives, and email archives moved – a lot of which lived in my “AppData” folder. I wanted to give my user profile room to “grow” – and I also wanted the performance benefit of having my user profile on a different physical hard drive from my OS drive.
The picture below shows what I ended up doing – I created an NTFS junction point for my user profile, and moved it onto a 2nd hard drive. The result: my OS drive, C:, is just my OS (and programs). The 2nd hard drive (labeled K:) is entirely my user profile. Obviously, it’s grown a bit since I moved it!
So what do you do if you’re in a similar situation and want to move your entire user profile to a different drive (or just a different location on the same disk)?
Enter NTFS directory junction points.
If you’ve ever used UNIX or Linux, you may be familiar with the concept – however, if you’re not familiar with the concept, it’s fairly simple to imagine (I’ve talked about it before as well). Basically, think of a junction as a file-system-level shortcut. Whereas “normal” Windows shortcuts only work in Windows (and are actually little files that redirect you when you click on them), a junction operates at a much “lower” level in the file system, silently redirecting access requests. (This Wikipedia article does a better job explaining what they are than I could ever do, if you’re curious.)
And that’s the key fact here – because support for a junction is built right into the NTFS file system itself, it’s basically invisible to any higher programs. (Programs can detect a junction of course, if they specifically ask – but few programs do.) So you can redirect any folder into another folder on your computer (including on a different physical hard drive). Which, coincidentally, is just what we’re after!
Before we begin though, it’s worth mentioning that this process involves moving your user profile files around – which can be risky if the move gets interrupted or something terrible goes wrong (power outage while you’re doing it, etc.). So take the time to do a complete backup of your data before trying this – but you knew that already, didn’t you?
So, with that said, here are the steps to move your user profile to another location using directory junctions:
Step 1: Prepare your 2nd hard drive (or whatever destination you’ve chosen) and pick (or create) a folder you want to “junction” to.
Step 2: Log out of your user profile and log back in under a different account. If you don’t have a 2nd account, just create one temporarily. Remember to give it full administrator power over your computer or you won’t be able to proceed!
Note that instead of doing this from a different user account, some people have more success doing this from the recovery console via the Windows installation CD/DVD. Either way will work; you generally only need to use the recovery console if you have some system process running that locks files located in your user profile; or if you’re trying to move the entire “Users” folder, rather than just your user profile folder.
Step 3: Move EVERYTHING out of your old user profile directory to your new profile directory (e.g., move everything from C:\Users\UserName to D:\Users\UserName). Don’t just copy the files, you need to move them, because you can’t create a junction if a folder by the same name already exists. Your user profile folder is C:\Documents and Settings\UserName if you’re using XP, or C:\Users\UserName if you’re using Vista or Windows 7. Make sure you move hidden and system files, too!
I’ve done this before by simply dragging & dropping in the Windows UI (having first told Windows to show hidden and system files, so I don’t miss them), but some people claim to have better experiences by using the command prompt and tools like RoboCopy. If you are more comfortable with one method over the other, then go with what you know best.
Note: if you run into trouble moving the files (for example, Windows tells you that files are still “in use”) you may need to reboot into “Safe Mode” to make sure there are no programs/services that are locking files that you want to move, or even use the “recovery console” that you can get from the Windows installation CD/DVD.
Step 4: Once you’ve moved all your files, rename your old user profile directory – it doesn’t matter to what, just as long as it’s different (e.g., rename it to C:\Users\UserName.old). You have to do this because when you create a junction, you are creating something, and that something is what links to the destination. If you leave your old folder there, and you try to create the junction with the same name, it won’t work.
Later, after you’re done with all these steps and you’re absolutely sure everything is working right, you can delete your old user profile directory – just make sure it is REALLY empty before you delete it!!! (Make sure to check for hidden and system files!)
Step 5: Open a command prompt (Start > Run > cmd will do the trick) and create the junction with the command:
mklink /J C:\Users\UserName D:\Users\UserName
Where “C:\Users\UserName” is the your old user profile folder used to have (before you renamed it in the previous step), and where “D:\Users\UserName” is the folder where you moved your profile folder’s contents to.
(If you are using Windows XP or earlier, you won’t have the mklink command on your computer – you can use the Sysinternals junction tool to do the same thing. The command line is a little bit different, so be sure to make that adjustment!)
Note: if you are using Windows Vista or Windows 7, you will probably have to right-click the command prompt and choose Run as Administrator.
Step 6: Now you can log out of this “temporary” user (or, if you did this from the recovery console, boot back into Windows) and back in as your regular user account. (You can delete the temporary account, as we’re done using it.)
If you did everything right, you should be able to log in normally and nobody will be the wiser (except for you, of course!). If you run into anything weird, check the caveats at the end of this article.
The beauty of this is that it works, and it works silently. Windows doesn’t notice a thing (well, it does, but it doesn’t say anything about it) – you’ll log on normally, and all your programs will just work. Folder redirection is beautiful like that.
Above: This is what a redirected user profile folder looks like in Windows Vista. Windows “knows” that it is a directory junction (hence the shortcut overlay icon), but it’s not really a “shortcut” in the traditional sense.
Above: after double-clicking on the user’s folder in the previous picture, you’ll see the user’s folders as you’d normally expect. Notice the address bar still shows this as being on the C: drive, even though it’s not. (Click the image for a larger version.)
Above: here’s the same folder, but instead of browsing to it via C:\Users, I went in through the K: drive (my 2nd hard drive). This is where the files really live. (Click the image for a larger version.)
Note that there ARE some caveats with this method:
- If you are using Windows XP, you will run into a bug with NTFS mount points.
- If you ever try to upgrade Windows, you may run into problems because of the redirection.
- If your destination folder is on a different volume then permissions will not be inherited and you will have to set the permissions on the destination folder manually (just copy them from your existing user profile folder).
- If your profile grows to be larger than the free space on your primary OS drive (usually C:), then you may have problems if you ever delete your user account and choose to “save the files” rather than delete them (something I ran into by accident myself).
- There are other caveats, warnings, and potential issues as well if you decide to try and do things differently than I’ve explained here (e.g., move the entire “Users” folder rather than just 1 user profile, or try to move other important folders, like the “Program Files” folder) – please read the comments on this article to see what other people have done.
Nevertheless, even with these warnings and caveats, using directory junctions is a highly effective method for moving your user profile out from the “default” location and into some other location of your own choosing. Hopefully, one day it will be possible in Windows to move your entire user profile to a different location without resorting to tricks like this, but for now, this is probably your best bet.
If you would like to know a little bit more about junction points, symbolic links, the mklink command, and so on, Wikipedia has several good articles to get you started:
- NTFS junction point (directory junction)
- NTFS symbolic link (only on Vista or later)
- NTFS hard links
- Sysinternals’ junction command (for Windows XP and earlier that lack the mklink command)
Related posts:
Related posts brought to you by Yet Another Related Posts Plugin.





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?
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?
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).
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?)
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.
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.
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!
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.
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).
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.
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.
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.
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.
The solution here is the Installer DVD command prompt. I´ll do some tests with this method. Seems to be a good option.
Yeaha, that was what i have looked for
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.
Yes, that WOULD have been a nice feature to have. (Hint, hint, Microsoft!)
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?
Make sure you are copying hidden and system files as well, otherwise your account won’t really be moved over.
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)
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.
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
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.
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?
Perhaps the profile is not moved over entirely? Or IE is trying to save downloaded files in a location that isn’t there anymore?
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.
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!
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.
Those are some very good tips – thanks for pointing that out!
It is not a good idea to run sdelete -c C: from a user which has been moved using this technique.
Why is that? That command just zeros out free disk space. Does sdelete get confused by the junction point or something?
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?
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.
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.)
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).
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.
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.”
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.
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.
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!
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
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
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.
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.
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.
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.
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.
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:
To verify, now go to the folder on the system drive and “dir” inside E:\Users. You will see the link made.
mklink /J E:\Users\ D:\Users\[Accountname]
9) Restart and enjoy!
Worked like a charm for me.
greetings
PietPara
Thanks for posting an alternative method!
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).
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!
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.
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
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.
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.
Seems your blog ate the
tags around that whole lot of shell output...The CODE tags don’t like empty lines, apparently. I fixed it for you.
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!
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.
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\ ?
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.
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.
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.
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
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!)
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
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 !
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’
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?
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.
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.
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?
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.
Thx. I will use mklink. Greatly appreciate your support!
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
You’re right – thanks for the correction!
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.
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
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.
Why not?
And ive no idea what that means??
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.
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
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.
Very interesting topic.
Thanks for sharing the ideas.
U guys are really rocking.
Haha, I find this funyn coz I have the exat samedrive name on my “D” (HAL)
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.
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!
amazing !!!!!!!!!! wow
it is working perfect, thanks….
You’re welcome; I’m glad it worked for you!
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!
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.
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
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.
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
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).
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.
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!!
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
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!
Great, thanks!
It works just fine for me, running windows 7.
Glad to hear it!
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]
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!
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
This is very interesting and it worked well, thanks!
I’m glad it worked for you!
Worked groovily – thanks for posting this!
Awesome! I’m really glad to hear it worked for you. It is always nice to do something that helps other people!