Link (computer)
As link ( English link or shortcut ) is known in the computer technology similar to a reference to an object at a different location, a cross-reference . The objects can be files or directories , for example , which are usually stored in a different storage location or are also managed under a different name. On the World Wide Web , links can refer to other Internet pages or sections within a page. A link can also establish a relationship between two or more objects; Such associations or relationships are often represented as a UML diagram or entity relationship diagram .
Links in the directory and file system
Links can generally be divided into the following five categories:
- File or desktop shortcuts
- Desktop shortcuts are files, mostly text files, that are interpreted by a graphical user interface and refer to a file or directory. They are used for the desktop icons or the entries in the start menu.
- By clicking, opening, executing or the like, the operation assigned to the file type is carried out for the object behind the link . For example, if there is a link to an executable file, it is started or if a reference to a folder is made, it is opened in the file manager .
- In addition, file links can contain further information, for example an icon that is used to graphically display the link or a descriptive text. On Windows, these files have the extension .lnk and FreeDesktop-compatible surfaces, such as KDE or Gnome , the extension .desktop .
- In contrast to symbolic and hard links, file links are not part of the file system, but are based on it and are application-specific.
- Symbolic links
- Symbolic links are special files that only consist of a short text, a path to another file or a directory, but are marked separately in the file system. The reference target does not necessarily have to exist: it may have been removed, moved or deleted in the meantime.
- Hard links
- In current file systems, hard links are the file name or names (more precisely: file entries in the directories) of a file. The content of the file is saved separately; at least one file entry refers to each file, but there can also be several file entries that reference the file ( surjective mapping ).
Property / action | Symbolic link | Hard link | Junction point | ||
---|---|---|---|---|---|
Delete the symbolic link / the hard link / the junction point ... | Target doesn't notice anything | Reference counter is reduced by 1; if 0, the target is logically deleted | Target will be deleted (except when using suitable tools; Windows: With A. created with "MKLINK / J", target will not notice anything.) | ||
Moving the target | Symbolic link becomes invalid | Hard link remains valid | Junction point becomes invalid | ||
Relative target specification | possible | (not applicable) | impossible (will be expanded when saving) | ||
Cross-file system: Cross-drive letters, partitions, and volumes | possible | impossible (because reference to the same file descriptor) | possible | ||
Reading out the target | possible | possible | |||
Windows | for files | from Vista / Windows 2008; (create only with administrator rights) | Yes | No | |
for directories | No | Yes | |||
Unix | for files | Yes | Yes | (not applicable) | |
for directories | Yes | yes (create as root, but not with all file systems) | (not applicable) |
Windows
There are five types of shortcuts in Windows.
File association
In the file association of Microsoft Windows is an ordinary, very small file containing the hidden file extension *.lnk
used. In the narrower sense, such file links are not referred to as links, but rather shortcuts under Microsoft Windows . These little Windows shortcuts point to another file or directory. A shortcut can also contain information on how to open the target. A file link can have a name that differs from the target and is usually provided with an arrow in the lower left corner of the symbol.
A Windows shortcut is visible, which means that the user sees the shortcut in Windows Explorer or other file managers as a shortcut. Most applications do not follow such shortcuts; when the application tries to open the file shortcut, it usually does not automatically open the target, but tries unsuccessfully to open the shortcut itself. In Windows shortcuts, no relative (. \ Subfolder \ file.txt), but only absolute path specifications are possible.
Folder link
In the folder shortcut ( English and virtual folder to dt. Virtual folder or virtual directory ) of Windows is it is a directory that contains the properties "read-only" and / or system , the one referring to the target file link with the fixed name target. lnk and a (hidden) desktop.ini file with (at least) the following content:
[.ShellClassInfo]
CLSID2={0AFACED1-E828-11D1-9187-B532F1E9575D}
A folder link is transparent (in Windows Explorer ) .
Folder shortcuts are created and used by Windows itself, for example in the network environment .
Shell Objects in Windows
Shell objects or shell folders areobjects thatare defined in the Windows registry . a. can also implement the function of a link. The (at least) necessary registry entries for such a shell object are as follows (whichCLSID\{00000000-0000-0000-0000-000000000000}
is used here as a placeholder):
[HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-000000000000}]
@="angezeigter Name"
[HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-000000000000}\DefaultIcon]
@="..." ; Pfad zum anzuzeigenden Symbol
[HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-000000000000}\InProcServer32]
@="%SystemRoot%\\System32\\ShDocVw.Dll"
"ThreadingModel"="Apartment"
[HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-000000000000}\Instance]
"CLSID"="{0AFACED1-E828-11D1-9187-B532F1E9575D}"
[HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-000000000000}\Instance\InitPropertyBag]
"Attributes"=hex:15,00,00,00
"Target"="..." ; absoluter (nur ohne "TargetKnownFolder" oder "TargetSpecialFolder")
; oder relativer Pfad zum Zielobjekt
"TargetKnownFolder"="{guidguid-guid-guid-guid-guidguidguid}" ; GUID des Zielordners, ab ''Windows Vista''
"TargetSpecialFolder"="0x00xy" ; CSIDL des Zielobjekts
[HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-000000000000}\ShellFolder]
"Attributes"=hex:00,00,00,00
Windows uses such linking shell objects itself, for example for the virtual folder My Documents on the desktop and fonts and administration in the control panel .
A shell object is transparent (in Windows Explorer).
Symbolic link
Since Windows Vista and Windows Server 2008 (both internally Windows NT 6.0 ), real symbolic links are available via the Win32 API , which are transparently present in the file system and can refer to files and directories on your own computer. Symbolic links can contain a relative target specification.
The Create Symbolic Link right is required to create this symbolic link . By default, this is only available to users with administrator rights. Furthermore, when creating the link it must be known whether the target is a file or a directory. For these reasons, the Windows symbolic links are not fully compatible with POSIX .
Junction points
Regardless, there are since the NTFS -Issue 3.0, that of Windows 2000 file system used by default, so-called "junction" (also English , [file system] reparse points ' or , junction points ' and shortly , junctions ' called). However, the associated administration tools were only supplied later, gradually from Windows XP, and such references were only displayed in Explorer (with the usual shortcut arrow, similar to file links ) only from Vista (but certainly from Windows 7 ) .
Junction points are much more similar to symbolic links to directories than "file links" or "folder links". Under Linux (and other Unix-like ones ), these junction points largely correspond to attaching directories to another location using mount --rbind
.
Starting with Windows Vista, junction points can be created via a command line with the command mklink /J
and with older Windows editions with the additional applications junction.exe and linkd.exe available from Microsoft - the former from the Sysinternals and the latter from the Windows 2003 Resource Kit Tools .
The following commands can be used to create a junction "C:\Neue Verbindung"
that "C:\Verzeichnis"
points to the folder . The content of "C:\Verzeichnis"
(the target of the junction point, English junction target ) can now also be called up in Explorer via "C:\Neue Verbindung"
(English junction directory ) or - the connection can be opened like a normal folder. Junction points are also retained after a Windows restart.
C:\>mklink /J "C:\Neue Verbindung" "C:\Verzeichnis"
or
C:\>junction "C:\Neue Verbindung" "C:\Verzeichnis"
or
C:\>linkd "C:\Neue Verbindung" "C:\Verzeichnis"
With the above-mentioned application and its retrofittable command junction[.exe]
, the target of an existing connection and (with the switch -s
, for ' Recurse s ubdirectories ') also other connections - recursively through subfolders - can also be displayed from Windows XP .
A junction point can be canceled using the following commands:
C:\>rmdir "C:\Neue Verbindung"
or
C:\>junction -d "C:\Neue Verbindung"
or
C:\>linkd "C:\Neue Verbindung" /D
The transfer value “d” stands for the English “ d elete ” or “ d eleting ” - that is, “ delete ” - and "C:\Neue Verbindung"
for the destination of the branch point created.
In contrast to real symbolic links, absolute paths are always saved in junction points. The following example shows how mklink
a new connection can be created with the commands and then dir
displayed with:
C:\>mklink /j "Neue Verbindung" Zielordner
Verbindung erstellt für Neue Verbindung <<===>> Zielordner
C:\>dir /al
Datenträger in Laufwerk C: ist abc
Verzeichnis von C:\
07.12.2010 10:30 <VERBINDUNG> Neue Verbindung [C:\Zielordner]
Junction points can also be displayed on the command line with the dir command , where <CONNECTION> (or < JUNCTION >) is output instead of <DIR> (for normal directories) . From Vista onwards , the reference target is also displayed, which can be queried separately for older Windows versions using the additional applications mentioned (or using the command fsutil
, see also analysis point ).
Folder blending
As of Windows Vista , write operations by programs that do not have write authorization for the corresponding directory are carried out under certain conditions without an error message; the actual writing process is redirected to a shadow directory in the user profile. This shadow directory is superimposed on the actual directory for this user, so that it looks to him as if the write process was carried out successfully.
Programs that do not correctly support the concept of restricted user rights can still run without an error message.
Cygwin and shortcuts
The Cygwin environment supports POSIX- compatible hard links and symbolic links . Hard links are transparently mapped to hard links in Windows. Existing junction points are displayed as symbolic links. However, symbolic links created by Cygwin are emulated, since Windows' own symbolic links are not fully POSIX-compatible. Such links are therefore only visible to Cygwin programs, other programs only see a file with a system attribute. This also applies to Vista and Windows 7. Cygwin also supports symbolic links that were created by Microsoft SFU . The reverse is not true. SFU also uses files for emulation, but in a different format.
Beyond the Windows world
Concepts similar to links can also be found in other operating systems: Unix supports soft links or symbolic links which allow access to a file via an alternative path. Creating they can be with the utility ln or in any graphical file manager, drag and drop. Under OpenVMS , a concept called Logical Name comes closest to the Windows shortcut. Such links are created with the DEFINE command.
Hyperlink
Hyperlinks are a special form of links and consist of an indication of the MIME protocolto be usedand a clear resource designation, e.g. B. the URL of a web link.
programming
Mapping of object relationships
A link can also establish a relationship between two or more objects; Such associations or relationships are often represented as UML diagrams or entity relationship diagrams and are used accordingly in object-oriented programming or in databases .
Reference / pointer
In programming, one can variable / identifier an alias be for another - will reference a new value assigned , so does the value of the "original" changes.
Program-specific links
There are also program-specific links, e.g. B. In Office suites, references to other documents or pictures. These can then usually only be evaluated by the corresponding application, but are basically only references to objects elsewhere.
Web links
- NTFS Link Shellextension (English) - context menu program for creating hard links, junction points and symbolic links on NTFS partitions
- Mark Russinovich: Inside the Windows Vista Kernel: Part 1. File-Based Symbolic Links
- GetFoldersize - Freeware for listing symbolic links, hard links and junction points
Individual evidence
- ↑ COM component manual: System programming and scripting with COM components - Addison-Wesley , 2001, ISBN 3-8273-1936-6 , p. 219.
- ↑ Specifying a Namespace Extension's Location (English) - MSDN , 2016
- ↑ The "Read-only" and "System" attributes of folders cannot be displayed or changed in Windows Server 2003, Windows XP, Windows Vista or Windows 7 - Microsoft Support , last changed September 24, 2011.
- ↑ Creating Shell Extensions with Shell Instance Objects on microsoft.com.
- ↑ a b Junction 1.06 - Microsoft TechNet ; 2016; accessed on August 6, 2016; u. a. also with "recursion in subdirectories"
- ↑ Windows Server 2003 Resource Kit Tools (English) - Microsoft; Status: April 28, 2003; Retrieved November 7, 2012.