Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.

Windows 7: Invalid junction after moving "My Documents"?

11 Feb 2013   #1

Windows 7 Professional SP1 - 32 bit
Invalid junction after moving "My Documents"?

A number of months ago I followed the "standard" procedure (using the Location property tab) for moving my special folders out of c:\users\xxx to new locations under d:\xxx, where d: is a separate partition on the same hard drive as c:.

As far as I can remember, this generally worked, though it made a mess of AppData by moving only parts of that tree and then failing due to locked files. I had to fix up AppData by hand, and in the end left it in its original location under c:\users\xxx. I successfully moved all of the other movable folders.

I've been having some unusual problems with a new online backup I'm trying out, which seems to be duplicating some files that are in My Documents... without going into all the details of that problem, I started to snoop around to try to see what might be causing the problem, and what I found was a junction in c:\users\xxx to My Documents that is pointing to c:\users\xxx\Documents - a location that does not exist on disk.

> dir /al
04/15/2012 06:05 PM <JUNCTION> My Documents [C:\Users\xxx\Documents]

Except for my problem with backup, things seem to work. But it seems any older program that happens to try to use a hardcoded path to My Documents could fail (or, could end up creating that folder I suppose...?).

If I right-click Documents in the Start menu, it shows 2 library locations: My Documents (D:\xxx) and Public Documents (C:\Users\Public). This seems normal.

If I type "My Documents" into Explorer, it takes me directly to Computer > D > xxx > Documents.

I have an icon for the top level of my user profile on my desktop. When I open it, Explorer shows me a mix of what's in c:\users\xxx and d:\xxx. If I have the folder options set to show protected system files, I see 2 copies of My Documents (one is the folder d:\xxx\Documents, the other is marked as a shortcut and is the junction). This is probably okay, but I'm not sure.

Still - it seems that the junction should have been updated when I moved My Documents, to point to the new location of Documents, no?

It is possible that when I originally switched the location of My Documents, I might have copied rather than moved the files, and then later deleted the original files. I'm not sure what is supposed to happen to that junction if you copy.... besides winding up with duplicate files, obviously. I've since read that copying is a bad thing to do, but not sure why it's an option then. Anyway, not sure if that's what I did, and if so, the best way to fix this.

I have seen people writing about junctions; and seen people writing about moving special folders, or taking it further and relocating their whole user profile; or relocating the whole Users folder. But all of these discussions have been with respect to either using the Location tab, or hacking the registry. I don't recall reading anything about what should happen to the file system junction to My Documents after doing a simple Location change.

Since I know MANY people have relocated My Documents and this is a very common issue, can any one who has relocated it please take a look at the original location and see what the junction shows?

At a command prompt:

> c:
> cd \users\xxx
> dir /al

That will show the junctions.

Does the junction for My Documents point to the correct location, or does it still show the original location at c:\users\xxx\Documents?

Assuming my junction is invalid, perhaps a fix is to back up my data, restore the default location, and then try to move it back again.

But perhaps there is a way to just correct the junction, by either modifying it, or removing it and then recreating it? I'm not familiar with the commands for doing this, and my concern is that during the time I am modifying the folder, I might possibly render my profile nonfunctional.

So perhaps I should do this from an alternate account with administrator privileges...

Any insights, suggestions, etc. would be greatly appreciated!

Thank you.

My System SpecsSystem Spec
12 Feb 2013   #2

Windows 7 Professional SP1 - 32 bit

Anyone have any thoughts on this issue?
My System SpecsSystem Spec
12 Feb 2013   #3

Microsoft Community Contributor Award Recipient

Microsoft Windows 7 Home Premium 64-bits 7601 Multiprocessor Free Service Pack 1

cd  %userprofile%
dir /als
What junction points are still there? Do you still have subfolders linke appdata and tracing?
Junction points are for "bad written" programs backwards compatibility btw.

Do you want whole profile to new location?
My System SpecsSystem Spec

12 Feb 2013   #4

Windows 7 Professional SP1 - 32 bit

These are the junction points currently in c:\users\xxx:

04/15/2012 06:05 PM <JUNCTION> Application Data [C:\Users\xxx\AppData\Roaming]
04/15/2012 06:05 PM <JUNCTION> Cookies [C:\Users\xxx\AppData\Roaming\Microsoft\Windows\Cookies]
04/15/2012 06:05 PM <JUNCTION> Local Settings [C:\Users\xxx\AppData\Local]
04/15/2012 06:05 PM <JUNCTION> My Documents [C:\Users\xxx\Documents]
04/15/2012 06:05 PM <JUNCTION> NetHood [C:\Users\xxx\AppData\Roaming\Microsoft\Windows\Network Shortcuts]
04/15/2012 06:05 PM <JUNCTION> PrintHood [C:\Users\xxx\AppData\Roaming\Microsoft\Windows\Printer Shortcuts]
04/15/2012 06:05 PM <JUNCTION> Recent [C:\Users\xxx\AppData\Roaming\Microsoft\Windows\Recent]
04/15/2012 06:05 PM <JUNCTION> SendTo [C:\Users\xxx\AppData\Roaming\Microsoft\Windows\SendTo]
04/15/2012 06:05 PM <JUNCTION> Start Menu [C:\Users\xxx\AppData\Roaming\Microsoft\Windows\Start Menu]
04/15/2012 06:05 PM <JUNCTION> Templates [C:\Users\xxx\AppData\Roaming\Microsoft\Windows\Templates]

The only real folders in c:\users\xxx are AppData and dwhelper.

Showing hidden files reveals all those junctions, plus all the ntuser.dat files.

I don't mind leave AppData here - while it has the Location feature, it doesn't work properly (files are open and won't move). I know there are ways to relocate AppData by hacking registry from some other logon, but I was okay just leaving it here.

I relocated all the other folders (Contacts, Desktop, Documents, Pictures, Videos, etc.)

So the only weird thing is the junction to Documents that points to C - it seems it should point to the current location I moved Documents to, which is D. But I haven't noticed any odd behavior - Windows knows where my Documents are, and obviously ignores this junction. Someday some bad application may depend on it though.

All other users on the system have all their files in c:\users. It's a bare minimal amount of data that I really don't care about enough to change. It's fine for it to all get imaged with my C: drive.

By "move whole profile" I guess you mean moving the whole xxx folder - or even the whole users location? - rather than relocating the separate Documents, Pictures, etc. - but again that might be more than I need on this system. Isn't that best done at the time of a fresh install? And I never had a fresh install - I started with a restore of the Dell factory image.
My System SpecsSystem Spec
12 Feb 2013   #5

Microsoft Community Contributor Award Recipient

Microsoft Windows 7 Home Premium 64-bits 7601 Multiprocessor Free Service Pack 1

(Contacts, Desktop, Documents, Pictures, Videos, etc.) don't have junction points (except documents).
So Contacts, Desktop, Pictures, Videos should work fine. Except if they're hardcoded in registry for some programs.

The 10 junction points you have are fine and are default. 9 of them point to Appdata... look yourself.

Only one junction point is a problem. That's "My Documents" (C:\users\xxx\documents)
Leave it the way it is. In very few cases an old winxp program will create file there instead of real documents folder.
Most likely it creates his own subfolder. You can move it to real documents folder. And change the setting within the program or somewhere in registry. Most of time it's uses as standard save folder.

So it's easy to fix and not a real problem. You still want to redirect it to correct folder?

"move whole profile"... you understand clearly.
My System SpecsSystem Spec
12 Feb 2013   #6

Windows 7 Professional SP1 - 32 bit

Okay, thanks - only problem is there is currently no actual Documents folder that the My Documents junction points to.

I think there was, and for a while I renamed it; then, I deleted it. I should probably put it back in case some app does write there.

I got rid of it because in some views of my profile I'd see two copies of My Documents.

If I create it as Documents, then rename it to something like Documents-C, if the junction is updated that will work; otherwise, I have to either name it Documents (and see 2 versions of Documents in some views), or have to modify the junction to point to the right file, in which case I might as well simply point the junction to where my real Documents is, on D!
My System SpecsSystem Spec
12 Feb 2013   #7

Windows 7 Professional SP1 - 32 bit

Actually the junction is useless. It points to c:\users\xxx\Documents, which I just recreated and in which I placed a dummy text file. I can cd to it, but dir shows the folder is empty. I can only see the file if I list the contents of c:\users\xxx\Documents directly.

I can change the name of c:\users\xxx\Documents. But none of this has any affect on the My Documents junction.

It's quite strange, and what I think I should do is point the junction to my real Documents and get rid of this extra folder I just created - I just don't know how to do that. I'd like the junction to just point to d:\xxx\Documents, which is where I think it should point.
My System SpecsSystem Spec
12 Feb 2013   #8

Microsoft Community Contributor Award Recipient

Microsoft Windows 7 Home Premium 64-bits 7601 Multiprocessor Free Service Pack 1

"my documents" is unreadable!! You can only access stuff by exact name.
You better fix the problem now if you really want.
  1. take ownership of "my documents"... so the junction point itself.
  2. delete the junction file in windows explorer
Now recreate junction I use D:\somewhere\Documents as real destination
mklink  /J  "C:\Users\xxx\My Documents"  "D:\somewhere\Documents"
Check if it's working. Just double click C:\Users\xxx\My Documents
Now make it hidden and system as it was before. Don't forget /L so it acts on junction itself!
attrib  +H  +S  +I  "C:\Users\xxx\My Documents"  /L
Finally make it the correct owner and permissions. Don't forget /L so it acts on junction itself!

icacls "c:\Users\xxx\My Documents" /setowner SYSTEM  /L
icacls "c:\Users\xxx\My Documents" /deny Everyone:(RD)  /L
My System SpecsSystem Spec
12 Feb 2013   #9

Windows 7 Professional SP1 - 32 bit

Thanks! I will follow these instructions. I appreciate your help.
My System SpecsSystem Spec
14 Feb 2013   #10

Windows 7 Professional SP1 - 32 bit

Okay, it worked! Excellent, thank you again.

There was one small problem I was able to work around:

This first icacls command fails (even when I fixed xxx to be the real name):

> icacls "c:\Users\xxx\My Documents" /setowner SYSTEM /L

Error message is:

c:\Users\xxx\My Documents: This security ID may not be assigned as the owner of this object.
Successfully processed 0 files; Failed processing 1 files

But I was able to set the owner to SYSTEM via Explorer Properties (security, advanced, owner, edit, entered SYSTEM, applied and exited properties, and it worked fine).

The subsequent icacls command, to deny everyone (RD), did work.

Wow. Feeling better about my system now, and when I view my profile in Explorer I'm happy that I only see one documents folder now. (I deleted the extra dummy Documents folder that the junction no longer points to.)

I wonder if Windows 7 always forgets to fix this junction when moving My Documents... I might test it in another account someday.
My System SpecsSystem Spec

 Invalid junction after moving "My Documents"?

Thread Tools

Similar help and support threads
Thread Forum
Moving "My Documents" folder, problem with Firefox/Google Chrome
Hello, I've been having some problems with my computer since some weeks ago, I decided to change my Document folder from C to D drive since I had games taking too much place into it. I created a new folder in my D drive and moved the folder there by using the move method of the folder. Since...
General Discussion
Restoring default location of "My Documents" after moving folder?
Hello all, Let me start of by saying that I have followed this tutorial: and have not had results. Additionally, I have 2 hard drives: An SSD solely for the Windows OS and an HDD for everything else. I'm...
General Discussion
moving the partition containing "my documents"
I currently have the "my documents" folder (and other folders) on a separate partition (E:) on a 2nd drive (drive 2). Drive 2 is failing (slowly) and I want to move E: off it, back to drive 1 with C:, but keeping it as a separate partition. I plan to use Partition Wizard to copy the old E: to...
General Discussion
Moving "My Documents"
Hello forum; I have a question about setting up a new SSD. I have installed the drive, and to save space I would like to move all the documents, pictures, music and other folders into my previous HDD. I have seen a couple of posts and tutorials on the subject, some seem to say moving the most...
"documents and settings" junction? disappeared
i've been on 7-64 now for some 3 months. i used to see "documents and settings" -folder, including "all users" on my explorer tree. from what i understand, this was a junction/shortcut to c:\users\ this morning, however, the whole documents and settings folder is no longer appearing, and with...
General Discussion

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 14:57.
Twitter Facebook Google+