Disclaimer: Accessing the information on this page means you agree to the Sites Terms of Service
Starting with windows 8, it shipped with a handy tool called mklink. Before windows 8, you had to download junction.exe from Microsoft which is basically the same thing, just a different name and a bit older.
When I setup my own personal computer, I move all of the c:\users\[username]\[folders] over to a different drive. The problem, is that programs tend to expect "Downloads" or "Documents" to reside in c:\users\[username]\Downloads, and if it doesn't exist, windows will create it for the annoying program, leaving you with two folders in both locations that don't know one exists over the other. PITA
The fix is to use mklink to create a JUNCTION between the c:\ drive and your data drive (we'll assume d:\)
You "could" use a symbolic link which does also work, but this ends up giving you a folder to both locations, so you end up with Downloads and as well as a shortcut to Downloads. Annoying.
Instead, create a junction between the two, then set the attributes to System and Hidden which hides it from Explorer as long as "Hide system files" is enabled in Explorer's options. When using the attrib command, you MUST use the /l switch which specifies the "symbolic link (junction)" instead of the destination (data drive). I tested and without /l, it applies the attributes at the data drive instead of the c:\ drive junction. This is the same way Microsoft was able to make "My Documents" point to "Documents" or "Application Data" point to "AppData" and yet remain completely hidden from the average user.
You'll have to modify the commands a bit to fit your environment, but this should give you a pretty good idea. I'm only giving examples for the common folders to move. If you move ALL of the folders inside c:\users\[username] to a data drive, you'll have to also repeat the process for the one's I don't mention below (contacts, desktop, favorites etc)
1) Open an Administrator command prompt
2) Change directories to C:\Users\[username]
3) First check to make sure there's nothing actually inside the respective folders inside c:\Users:\[username]
cd Documents
dir
If nothing is there, change directory back to the user dir
cd ..
4) Next, you'll have to delete the empty directory inside c:\Users\[username] first. For example, use the following to delete Documents
rmdir /s /q Documents
5) Finally, let's create a junction to the folder you just deleted, then hide it from explorer
The following commands assume you are inside C:\Users\[username]
Change [username] to your actual username folder name (for example the folder for "John Smith" might actually be johnsmith
mklink /j Documents d:\users\[username]\Documents
attrib /l +s +h Documents
mklink /j Downloads d:\users\[username]\Downloads
attrib /l +s +h Downloads
mklink /j Music d:\users\[username]\Music
attrib /l +s +h Music
mklink /j Pictures d:\users\[username]\Pictures
attrib /l +s +h Pictures
mklink /j Videos d:\users\[username]\Videos
attrib /l +s +h Videos
Maybe down the road, I'll come up with a batch file to help automate the process...
Removing a junction or symbolic link can be a little tricky, especially if you've applied the +s and +h attributes.
First and foremost, NEVER issue the del command to delete a link (symbolic or junction). This will delete all files in the TARGET folder! (Better have a backup!)
Instead, you will need to issue the rmdir command. If you get "Access Denied", you will have to start back tracking the attributes on the link folder, starting with the /l switch. If it has a "R" (as in SHR, or an R by itself) it is "read only" so yank off the read only from the attrib /l method. Next run attrib by itself on the link folder. This should be R (no S or H). Once the attrib /l shows no attributes present, (no SH or R), rmdir "should" work. (Make sure you're running command prompt as an administrator).
The other method is to show hidden files and folders and show system files and folders in explorer, then just delete the shortcut (link) folder from explorer which in all honesty, is probably a lot easier.
Post Comment