On modern Windows, My Documents is not a normal folder. It is a legacy junction kept for old software. A junction is an NTFS reparse point that silently redirects one path to another, and Windows intentionally blocks listing it.
Initial behavior
C:\Users\handrew>dir /b Documents
No output because the folder was empty.
C:\Users\handrew>dir /b "My Documents" File Not Found
This looks like the folder does not exist, but it actually does.
If a script insists on enumerating "My Documents", it will always think the folder is missing even though file reads and writes still work through the junction.
Creating files
C:\Users\handrew>type nul> "This is Documents">Documents\this_is_documents.txt C:\Users\handrew>type nul> "This is My Documents">"My Documents"\this_is_my_documents.txt
Both commands succeed.
C:\Users\handrew>dir /b "My Documents" File Not Found
Still cannot list it.
C:\Users\handrew>dir /b Documents this_is_documents.txt this_is_my_documents.txt
The file written through My Documents shows up in Documents.
Dir /al flag shows the junction
C:\Users\handrew>dir /al . | find "ocument" <JUNCTION> Local Settings [C:\Users\handrew\AppData\Local]
My Documents is a real NTFS junction, the kind Microsoft documents here: Hard Links and Junctions.
Trying to list from inside
C:\Users\handrew>cd "My Documents" C:\Users\handrew\My Documents>dir File Not Found
Listing is blocked on purpose.
Permissions explain everything
C:\Users\handrew>icacls "My Documents"
My Documents Everyone:(DENY)(RD)
NT AUTHORITY\SYSTEM:(I)(OI)(CI)(F)
BUILTIN\Administrators:(I)(OI)(CI)(F)
WINDOWS11H2\handrew:(I)(OI)(CI)(F)
RD means Read Data or List Directory.
Windows allows path resolution and file creation, but blocks enumeration. This prevents infinite recursion and forces modern software to use the real Documents folder.
Explorer hides all of this. cmd.exe shows the cracks.
Bottom line: treat "Documents" as the real path, and expect legacy names like "My Documents" to resolve but not list. This was tested on Microsoft Windows 11 24H2 (OS Build 26100.7623).
Other junctions
C:\Users\handrew>dir /al Directory of C:\Users\handrew 11/09/2025 01:32 PM <JUNCTION> Application Data [C:\Users\handrew\AppData\Roaming] 11/09/2025 01:32 PM <JUNCTION> Cookies [C:\Users\handrew\AppData\Local\Microsoft\Windows\INetCookies] 11/09/2025 01:32 PM <JUNCTION> Local Settings [C:\Users\handrew\AppData\Local] 11/09/2025 01:32 PM <JUNCTION> My Documents [C:\Users\handrew\Documents] 11/09/2025 01:32 PM <JUNCTION> NetHood [C:\Users\handrew\AppData\Roaming\Microsoft\Windows\Network Shortcuts] 02/08/2026 01:54 PM <DIR> OneDrive 11/09/2025 01:32 PM <JUNCTION> PrintHood [C:\Users\handrew\AppData\Roaming\Microsoft\Windows\Printer Shortcuts] 11/09/2025 01:32 PM <JUNCTION> Recent [C:\Users\handrew\AppData\Roaming\Microsoft\Windows\Recent] 11/09/2025 01:32 PM <JUNCTION> SendTo [C:\Users\handrew\AppData\Roaming\Microsoft\Windows\SendTo] 11/09/2025 01:32 PM <JUNCTION> Start Menu [C:\Users\handrew\AppData\Roaming\Microsoft\Windows\Start Menu] 11/09/2025 01:32 PM <JUNCTION> Templates [C:\Users\handrew\AppData\Roaming\Microsoft\Windows\Templates] C:\Users\handrew>dir /al c:\ProgramData Directory of c:\ProgramData 11/09/2025 11:30 AM <JUNCTION> Application Data [C:\ProgramData] 11/09/2025 11:30 AM <JUNCTION> Desktop [C:\Users\Public\Desktop] 11/09/2025 11:30 AM <JUNCTION> Documents [C:\Users\Public\Documents] 11/09/2025 11:30 AM <JUNCTION> Start Menu [C:\ProgramData\Microsoft\Windows\Start Menu] 11/09/2025 11:30 AM <JUNCTION> Templates [C:\ProgramData\Microsoft\Windows\Templates] C:\Users\handrew>dir /al c:\users\public\documents Directory of c:\users\public\documents 11/09/2025 11:30 AM <JUNCTION> My Music [C:\Users\Public\Music] 11/09/2025 11:30 AM <JUNCTION> My Pictures [C:\Users\Public\Pictures] 11/09/2025 11:30 AM <JUNCTION> My Videos [C:\Users\Public\Videos]
No comments:
Post a Comment