How does Windows treat these paths and how to emulate?

0

Within Windows Explorer folder/libraries for folder such as Desktop, Downloads, Documents, Images, 3D Objects, Music and Videos, etc. one can simply type these names and press Enter and easily get there and/or have the folder open.

I thought this as common behavior for all libraries, but Downloads nor 3D Objects are libraries on Windows.

Also, all these folders are listed under "This PC".

Pictures for reference:

enter image description here

enter image description here

How Windows treats these folder paths? e.g. a symlink.

How to replicate this behavior?

PS: For any other name typed will go to http://name/

Deltab

Posted 2018-02-24T01:35:48.537

Reputation: 135

Answers

2

To replicate this behavior to work just as you describe when typing in the folder name into Run (e.g. Desktop, Music, etc.) and pressing enter to open those up you can simply use mklink and create a directory junction or a symbolic folder link to the folder on the root of the user profile directory.

mklink /d "%userprofile%\<Name>" "<C:\FolderPath\ToLink>"

or

mklink /j "%userprofile%\<Name>" "<C:\FolderPath\ToLink>"

Now from Run you can type in the name of the link and press Enter and it'll open that folder just as it does for Desktop, Music, or any other folder or link on the root of the user profile directory.

Actually, you could create the link in any folder that's in the PATH environmental variable and it'll work just the same but I provided what matches the folders you gave examples.


Further Resources

  • MKLink
  • mklink /?

    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.
    

Pimp Juice IT

Posted 2018-02-24T01:35:48.537

Reputation: 29 425