In search of better tools for NTFS reparse points (junctions, symlinks)

Back in 2006 when solid state drives were fairly new and their sizes were pretty small I found myself with a problem. The drive was too small to hold both the operating system, my programs and all of my documents, photos, videos, etc. While it was acceptable to simply save all of my files to a second, larger, hard drive it wasn’t exactly intuitive the way working with the Documents and Settings or Users folder was.

When I first discovered Junctions I thought I had found the perfect solution. With a junction I could copy the entire C:\Users directory to a totally different drive and then trick Windows into thinking it was still on my C: drive with a junction. After some concerted effort I did just that. The problem with my approach though is that it requires manually recreating all of the junctions and symlinks hidden throughout the C:\Users directory tree. Ouch!

What I have needed for so long was some good tools to make the process easier (and less error prone). Even as of 2014, robocopy still only has bare bones support for symlinks while junctions are entirely broken. So today I am releasing my efforts to dramatically expand the tools available for working with NTFS reparse points on Windows. It’s called ntfslinkutils.


ntfslinkutils is a collection of command line utilities for Windows designed to copy (cplink), move (mvlink), delete (rmlink) and even fix (fixlink) junctions and symbolic links. With these tools you can manipulate every junction and symlink in an entire directory tree and even rewrite the targets of each along the way.

As per usual I am releasing the code as open source under the generous BSD license. You can find pre-built binaries available for download here. Note you may need to install the Visual C++ Redistributable for Visual Studio 2012.

I hope you find these new tools as useful as I do!

Update 2014/9/18: I have removed the Visual C Runtime Library requirement in order for the tools to run under the Windows Pre Installation Environment (PIE). While I have tested this with Windows 8.1 I am unsure if they work with previous versions. Please let me know in the comments if you have a chance to try them on Windows Vista/7.

Relocating Windows User Data

Quite some time ago I wrote a post about how to relocate the C:\Users and C:\ProgramData directories of a Windows installation to another drive. This is useful for those of us whom want to use a different hard drive for the operating system and keep documents elsewhere. In my case, my OS is installed to a solid state drive that is simply too small to fit all of my documents, music and pictures. I simply needed a better way to store all the data. When I discovered NTFS junctions (aka: reparse points) I realized I could do just that. I could finally put some breathing room between my operating system and my data.

Now that Windows 8 is here (well almost) I realized I was going to need to move all that data over yet again. In previous years, relocating user data was a pain, specifically because of all the reparse points that have to be fixed recreated once the data is copied to the new drive. Making sure you recreate every reparse point can be quite challenging. Moreso, if you miss one it could mean very bad things when you try to boot the system up again. This got me thinking, why not just write a program to do all that dirty work for me? And so I did.

The program is called MoveUserData. It runs at a command prompt and is intended to be used in the Recovery Console (so that security rights are not an issue). Below you will find the program and full source code.

Using the program is quite simple. Copy MoveUserData.exe to a USB drive or CD. Boot the Windows installation disc and go into Windows Recovery mode. Choose Command Prompt from the list of recovery options. Once you are at a command prompt put the CD/USB drive containing MoveUserData.exe into the computer.

Assuming that your Windows installation drive (normally C:) is currently listed as K:, your data drive is D: and that the CD/USB drive is set to E: then you can execute the following commands.

The program will do the rest. Once done, just reboot!

Disclaimer: As stated in my previous article, messing around with your operating system like this is very dangerous. While I have made every effort to ensure the program works as described it is still possible that errors will occur. So make sure to back up your drive first. Use of this program is at your own risk.

Update [October 5, 2012]:
So despite my rigorous testing of the program it appears that it doesn’t actually work in the scenario in which I intended, the command prompt of the Windows Preinstall Environment (installer discs). Truth be told I never actually tested it in this scenario because it would have made development incredibly slow and complicated. Instead I tested using a duplicated data set on a separate pair of drives from my main system. Apparently that was a big mistake on my part since it would seem .NET based applications like mine don’t run at all in Windows PE. Bummer!

An aside: Why on earth would Microsoft develop the .NET framework and market it as the end-all-be-all of Windows’ platform development if they don’t include support in Windows PE? That seems like a huge gap in judgement.

Back to the real issue at hand. Since no C#/.NET programs will work I am rewriting the utility entirely in C++. So stay tuned!