All you need to know about symbolic links in Windows 10

10.48
All you need to know about symbolic links in Windows 10 -

In Windows 10, you can use symbolic links to easily redirect a folder to another location. Symbolic links are widely used in the operating system for its own files and folders. Using symbolic links, you can save your disk space and make your data available from various file system locations without moving your data physically.
Symbolic links can be quite useful in many situations. For example, recently I added a SSD in my computer and install Windows there. All my portable applications remained in the D: cell and many of them have been configured to work with the D: documents. The problem was that before I added this new SSD, the path to the folder is C: portable and C :. Documents

For these two cases a symbolic link that I had all this work in seconds. I created symlinks c: notebooks and c: documents without moving a file or a folder. Another interesting thing is that if I move my symbolic links to another location, for example, drive E :, they continue to work and will point to my files on D :. Player

This is how symbolic links can be created.

For the management of the symbolic link, Windows offers many ways.

The most famous tool is mklink. It has the following syntax (mklink /?)

 MKLINK [[/D] | [/H] | [/J]] Link Target 

/ D - Creates a symbolic link directory. Default is a file symbolic link
/ H -. Creates a hard link instead of a symbolic link
/ J -. Creates a Junction
Link directory - .. Specifies the new symbolic link name of
Target - Specifies the path (relative or absolute) that the new link refers to

Now you may ask be what is the difference between a symbolic link directory and a directory junction

.. what is the difference between a symbolic link directory and a directory junction
a Junction directory is an older type of symbolic link that does not support the UNC (network paths that begin with \) and relative paths. Directory junctions are supported in Windows 00 and Windows NT-based systems later. A symbolic link directory on the other hand also supports UNC and relative paths. However, they need at least Windows Vista. Thus, in most cases today, the directory the symbolic link is the preferred option.

What is the difference between a hard link and a symbolic link
A link can be created only for files, not folders. You can not create a hard link directories. So it has more limitations than a Junction directory and also does not support UNC paths.

How to see if a file or folder is a symbolic link
We will create three types of symbolic links and see how they will be displayed in the operating system.
I will create the Winaero folder on my desktop and Winaero.txt text file in the same location.
Then I'll create a new symbolic link and a new Junction directory for the file and the text file.

mklink the command requires administrator privileges, so you need to run it from an elevated command prompt.

the following command to create a new directory symbolic link

 mklink / d "c:  users  winaero desktop  directory symbolic link " "c:  users  winaero  desktop  winaero "

Windows 10 create directory symbolic link A symbolic link directory can be visually identified by the shortcut icon overlay added to its main icon: Windows 10 directory symbolic link overlay icon

again, when you have enabled the "Attributes" column in the detail view of the file Browser, you will see the "l" attribute indicating that it is a symbolic link. Windows 10 directory symbolic link attributes

Now let's create a new junction directory for Winaero folder, as follows:

 mklink / d "c:  users  winaero  desktop  directory junction "" c:  users  winaero  desktop  winaero "

Windows 10 create directory junction it has no visual difference from a directory symbolic link in Explorer files, so you can not tell if it is a directory or symbolic link directory junction Windows 10 directory junction in explorer

the only way to find the link type is to use the command console dir . Open a new command prompt window to the folder that contains your link and run the dir command. See the output: Windows 10 links in cmd dir output

Now we will create a symbolic link to the text file I created. The command is as follows:

 mklink "c:  users  winaero  desktop  symbolic link.txt file" "c:  users  winaero  desktop  winaero.txt" 

Windows 10 file symbolic link command again, it is visually different from a regular shortcut file, besides the value of the attributes of the column and the "symlink" Type:

Windows 10 file symbolic link in explorer Windows 10 file symbolic link

the situation is different for hard links . We will create a

 mklink / h "c:  users  winaero  desktop  link.txt disk file" "c:  users  winaero  desktop  winaero.txt" 

Windows 10 file hard link command hard link is no visual difference from a regular file when displayed in file Explorer: Windows 10 file hard link in explorer Windows 10 file hard link on desktop

the only way to ensure that the file is a hard link is to use another console utility. fsutil
Run as

 fsutil hardlink list "link.txt disk file" 

The specified command shows all files fixed link: Windows 10 file hard link in fsutil

you can not see if a file is a link easily because the Explorer of the box gives no indication. They behave like regular files in the production of a dir command or the File Explorer.

However, hard links are still links to other files. They do not reproduce the contents of the target file and do not take the redundant disk space

In Windows Vista and later, directory junctions are used to connect the paths of old files as folders C :. Documents and Settings for newer paths like C: Users. Symbolic links are also used to redirect C: Users All Users to C :. ProgramData

from Windows Vista, hard links are also widely used by Windows and its maintenance mechanism. Many system files are hard links to the files in the Windows folder store components. If you run the fsutil hardlink list command to explorer.exe, notepad.exe or regedit.exe, you can see for yourself!

Windows 10 system hard links The record stores various files WinSxS system, which are linked by hard links files in the C: Windows, C: Windows System32 and other system files. When using the system updates are installed, the files in WinSxS interior is updated and difficult system-related sites again.

There. Now you know everything you need to know about symbolic links in Windows 10. Using this information, you can solve problems with the roads when you add a new drive in your computer, or move a file, but still need it is accessible via its previous path. Feel free to leave a comment if you have a question or something to add.

Previous
Next Post »
0 Komentar