# Making Links and Junctions

A link in general terms is a file or folder that points, or redirects to another file or folder. Windows supports four distinct types of link:

* **Shortcuts**: The ones you're probably most familiar with, these are implemented as a separate .lnk file (although the file extension is often hidden), that stores the details of the file or folder it points to. Shortcuts can refer to a file or folder on any drive, including on a network share.
* **Hard links**: Hard links can only point to a file. They are implemented at the file system level. Technically speaking, all files are "hard links" - there's no concept of an original file. Once a link has been created, there is no way to tell which one is older. A file is only deleted when the last hard link that points to it is deleted. Hard links can only be created on the same drive partition as the original file.
* **Junctions**: Junctions can only point to a folder. They are implemented at the file system level.
* **Soft links**: Soft links are only available in Vista and later. A soft link can point to either a file or a folder, and they are able to span hard drives. Creating a soft link requires administrator permissions - Opus will display a [UAC](../file_operations/uac_and_administrator_mode) prompt if needed. Soft links can be _absolute_ or _relative_.

Note that hard links, soft links and junctions are only supported on NTFS-formatted drives.&#x20;

Windows (particularly in Vista and above) uses links and junctions quite a lot. If you turn off the **Hide protected operating system files** option on the [**Folders / Global Filters**](../preferences/preferences_categories/filtering_and_sorting/global_filters) page in Preferences, you will notice several folders appear in red in various locations (the root of _C:_ for one, and your user profile folder). Microsoft uses these hidden junctions to maintain backwards compatibility with software that has hard-coded the names of legacy paths. For example, in Windows XP, user data is stored in _C:\Documents and Settings_, but in Vista and above it's in _C:\Users_. By default Windows creates a hidden junction called _Documents and Settings_ that points to the new _User_ folder, so that software that specifically references the old path will still operate.

![](https://3597805814-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3XSZSwWow0fDf6fQJobd%2Fuploads%2Fgit-blob-e86f32c7698bfdc01d633bcf3c2ff5195e2d589a%2Fjunction_targets.png?alt=media)

If you turn on the **Description** column in a Lister you can see the target of links and junctions. See the [Folder Options](../basic_concepts/folder_options) section for information on adding columns to the display.

Opus is able to create all these types of links for you. Creating a shortcut is the simplest, and you can do this in Opus just as you can in Explorer, either by:

* Dragging and dropping an item with the right mouse button. The popup menu will contain a **Create Shortcut Here** command.
* Copying a file or folder to the clipboard, and then right-clicking in a folder and choosing the **Paste Shortcut** command from the context menu.

Aside from basic shortcuts, other types of links and junctions are generally used only rarely and by experienced users (at least on Windows). If you are not familiar with how they work, be careful and test with copies of both target and source folders first. Be aware that most actions in most software are not "link aware". For example, be careful when deleting or overwriting links that you are not deleting or overwriting the things they point to, unless that is your intention. Test how the things behave first before risking important data!

Commands to create the other types of links and junctions can be found in the default toolbars under the **Copy Files** button's menu, within the **Create Advanced Links** sub-menu:

![](https://3597805814-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3XSZSwWow0fDf6fQJobd%2Fuploads%2Fgit-blob-4a8866f318b66d29561a558d3cb889e0f4c2af1c%2Fmakinglinks_menu.png?alt=media)

Like the main **Copy Files** button itself, the menu items work between dual file displays, taking the selected items in the source folder and creating junctions or links in the destination folder which point to them.

Behind the default menu items is the internal [**Copy**](../reference/command_reference/internal_commands/copy) command, which is used to create shortcuts as well as the other types of links. For example, you the command to create a button or menu item to create soft links in the destination folder to selected files in the source is: **Copy MAKELINK=softlink**.

When creating soft links, there are two ways the target of the link can be stored:

* _Absolute_ links store the entire path name of the link target. Absolute links can reference files or folders on different drives as well as the same drive.
* _Relative_ links store the path of the target relative to the location the link is created. For example, consider the following:\
  \* **Link path**: _C:\Test\Folder\Link.txt_
  * **Target path**: _C:\Test\Original.txt_\
    Creating _Link.txt_ as a relative link would store the target path as _..\Original.txt_ - the **..** notation indicates the parent folder. The advantage of a relative link is the common parent folder (in this example, _C:\Test_) can be renamed or moved, and the link will still work. Relative links are created using the **Copy MAKELINK=relsoftlink** command. If the target path can not be expressed relative to the link path then a regular, absolute link will be created instead.

See the documentation on the [**Copy**](../reference/command_reference/internal_commands/copy) command for more information, and the [Customize](../customize) section for information on how to configure buttons and hotkeys. You may also like to see the File Types [Drop Menu](../file_types/filetype_editor/drop_menu) page - it's possible to add commands to the drag-and-drop menu, and you could, for example, add a **Create Softlink** command to go along with the **Create Shortcut** command that already appears on this menu.

![](https://3597805814-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3XSZSwWow0fDf6fQJobd%2Fuploads%2Fgit-blob-d8e1947ce1e4ba1dbdbd1b9ef022a7c0154226b8%2Fdrop_menu_-_results.png?alt=media)
