- Как создать символьную ссылку в Windows 10, 8.1, 8, 7
- How to Create Symbolic Links (Symlink) in Windows 10
- What Are Symbolic Links?
- Create Symbolic Link Using Link Shell Extension
- Create Symbolic Link Using Mklink
- Как создать символьную ссылку в Windows 10, 8.1, 8, 7
- How to create symbolic links for multiple files in multiple folders using command prompt or power shell?
- 3 Answers 3
- How to create a link to a file, folder, or library on your computer
- Method 1: How to create a link to a file on your computer, using the Sharing Wizard (also works for hyperlinking folders or libraries)
- Method 2: How to create a link to a file on a shared drive, using File Explorer (also works for hyperlinking folders or libraries)
- My file path link doesn’t work! Why?
- Do you use file hyperlinks?
Как создать символьную ссылку в Windows 10, 8.1, 8, 7
Товарищи, добрый день. Хотя эта тема и не самая популярная, но она мне очень много раз выручала, поэтому я не могу о ней не написать. Итак, что значит термин «символьная ссылка» я возьму из энциклопедии Wikipedia:
Символьная ссылка (также симлинк от англ. Symbolic link, символическая ссылка) — специальный файл в файловой системе, для которого не формируются никакие данные, кроме одной текстовой строки с указателем. Эта строка трактуется как путь к файлу, который должен быть открыт при попытке обратиться к данной ссылке (файлу). Символьная ссылка занимает ровно столько места в файловой системе, сколько требуется для записи её содержимого (нормальный файл занимает как минимум один блок раздела).
По своей сути же, симлинк — это ярлык, который позволяет системе думать, что это не ярлык, а настоящий файл (или папка). К примеру, частое применение символьной ссылок для папок — это установка игры на SSD, с последующем переносом файлов графики на жесткий диск, с целью экономия места на SSD и создание символьной ссылки до исходного места. Игра будет думать, что все файлы находятся в исходной папке. Так же символьные ссылки можно применять когда используются одинаковые файлы в нескольких каталогах, чтобы не вносить правки во все файлы, можно создать с одного файла символьные ссылки и вносить изменения один раз.
Создать символьную ссылку очень просто и сейчас я вам это докажу. Открываем командную строку, нажимаем Win+R, вводим cmd и жмём ОК. Хотя если вы собираетесь работать с системными файлами, может понадобиться командная строка с правами администратора.
Дальше нам нужно ввести команду для создания символьной ссылки, выглядит она следующем образом:
где /j — атрибут создания соединения для каталога. Если вы создаете ссылку на файл, атрибут ставить не надо.
К примеру, если я хочу создать символьную ссылку на папку mklink на локальном диске E, как папку mk на диске С, мне нужно ввести следующую команду (и да, символьная ссылка может называться не так, как исходный файл (папка):
В результате мы получим вот это.
Если же мы хотим создать символьную ссылку на файл, например на файл 1.txt, хранящийся в корне диска E. для использования в виде файла 2.txt. скажем в папке mslink на диске C, команда будет выглядеть вот так:
А на выходе получим вот это.
Резюмируя скажу, что знание возможностей данной функции, открывает большие возможности. С помощью неё я выходил из нескольких ситуаций, когда не хватало свободного пространства, на моем старом SSD, позволяя быстро перенести игру из папки origin на другой диск. Но вариантов использования её гораздо больше, к примеру перенос кэша браузеров, о котором мы поговорим в одной из будущих статей.
Вроде всё. Надеюсь эта статья оказалась вам полезной, обязательно нажмите одну из кнопок ниже, чтобы рассказать о ней друзьям. Также подпишитесь на обновления сайта, введя свой e-mail в поле справа или подписавшись на группу во Вконтакте и канал YouTube.
Спасибо за внимание
How to Create Symbolic Links (Symlink) in Windows 10
Symlinks or Symbolic Links is one of the lesser known, yet useful, features in Windows. You can think of symbolic links as the shortcuts you create in Windows. However, symbolic links are much more powerful and helpful than regular shortcuts. Let’s discuss what symbolic links are and how you can easily create them in Windows 10.
What Are Symbolic Links?
When you create a shortcut for a file or folder, all you are doing is pointing it to that specific file or folder, nothing more. Symbolic links are much more than a simple shortcut. They act as a virtual file or folder that links to the actual file or folder.
When you create a symlink for a file, it appears as if it is the actual file when in reality it is redirecting you toward the real file in the background. Besides files, you can also create symlinks for folders. Simply put, a symlink is nothing more than a build of the text string which lets the operating system know that it is just a path for another file or folder.
For instance, most cloud service apps you install will only sync files and folders located in their own folder. But there will be times when you might have a folder in some other drive you want to sync with the cloud storage service.
However, you don’t want to move the folder from its actual location or don’t want to create a copy of the folder. In those situations you can simply create a symlink in the cloud service folder so that you can sync the contents of the target folder without actually moving or copying the real folder.
Since a symlink is just a virtual folder that just acts as a path to the real folder, you don’t have to worry about the symlink consuming your disk space.
Create Symbolic Link Using Link Shell Extension
If you don’t want to faff around in the Command Prompt and are prepared to faff around a little bit by installing a tool that lets you create symlinks to an existing file or directory using the right-click context menu, then try the following. Link Shell Extension is a tool that lets you create hardlinks and symbolic links by right-clicking whatever folder you want to create a link to.
There are a few hoops with the installation. You’ll get a warning that it can’t be downloaded securely, and Windows Defender may warn you that it’s “unsigned.”
We can assure you that the tool is safe. Go ahead and install it. During installation, explorer.exe will restart, so make sure you have important stuff backed up.
Once LSE is installed, right-click the target file or folder you want to create a symlink to, then click “Pick Link Source.”
Next, go to the folder where you want the symlink to appear, right-click it, then select “Drop As -> Symbolic Link.”
Create Symbolic Link Using Mklink
Note: though I’m showing this in Windows 10, the commands shown here are applicable to Windows Vista and up.
Creating symlinks in Windows is pretty easy with the mklink command. To start, press Win + X , then select the option “Command Prompt (Admin)” to open the Command Prompt with admin rights.
Once the command prompt has been opened, use the below command format to create a symlink for a file.
In my case, I want to create a symlink in the E drive for a text file located on the F drive, so the command looks something like this:
The first path you see in the above command is where you will create your symlink. This path is called a “Link.” The second path belongs to the actual file on your disk and is called “Target.”
Once the symlink has been created, this is how it looks in the File Explorer. Though the icon looks like a regular shortcut, it is a symlink.
Along with individual files, you can create symlinks for entire directories. To do that, use the below command. The switch /D allows you to do this.
As soon as you execute the command, the symlink will be created for the target directory. You can use it to access all the files and folders inside the real folder. If you ever want to, you can delete the symbolic link like any other file or folder. Just select the symlink, press the delete key on your keyboard, and you are good to go.
And you’re done! If you want to do more under-the-hood tweaking in Windows 10, see our list of the best registry hacks. Also, check out our guide on how to get Mac-style hot corners in Windows 10.
Как создать символьную ссылку в Windows 10, 8.1, 8, 7
Здравствуйте. Не самая популярная, но очень полезная функция, которая доступна в современных операционных системах. Она позволяет сделать ссылку на папку (как бы ярлык), по которому система будет думать, что работает с реальной папкой (либо файлом, так тоже можно), находящийся в месте, где находится ярлык. Если взять термин из википедии:
Символьная ссылка (также симлинк от англ. Symbolic link, символическая ссылка) — специальный файл в файловой системе, для которого не формируются никакие данные, кроме одной текстовой строки с указателем. Эта строка трактуется как путь к файлу, который должен быть открыт при попытке обратиться к данной ссылке (файлу). Символьная ссылка занимает ровно столько места в файловой системе, сколько требуется для записи её содержимого (нормальный файл занимает как минимум один блок раздела).
Раньше я очень часто переустанавливал систему, так как имел сайт и при написании статей проводил очень много экспериментов с системой, некоторые из которых, сложно было обратить и проще было переустановить или восстановить систему из бэкапа. А параллельно я ещё играл, и чтобы каждый раз не качать заново игру, я хранил их на отдельном SSD и просто делал символьные ссылки в основной каталог Origin (со стимом проще, там можно несколько директорий выбрать). Мой товарищ использовал символьные ссылки, чтобы размещать папки с текстурами (самое тяжелое в играх) на RAM-диск, для ускорения их загрузки.
Итак, функция крайне полезна и имеет много вариантов использования. А ещё, она довольно проста в использовании. И сейчас постараюсь объяснить, как ей пользоваться. Для начала нам нужно запустить командную строку, есть несколько вариантов, мне самым быстрым кажется следующим:
1. Жмём сочетание клавиш Win+R и вводим в открывшееся окно cmd
2. Теперь нам необходимо ввести команду чтобы создать символьную ссылку, структура команды для ОС Windows примерно следующая:
mklink /j «путь, где будет создана символьная ссылка» «путь, где находятся исходный файл или папка»
где, /j — атрибут обязательный при указании ссылки на каталог, если вы создаете ссылку на файл, не ставьте его.
Теперь перейдем к примеру. Предположим, что я хочу создать символьную на папку EHOT на локальном диске D , как папку link на диске C , для этого мне нужно ввести следующую команду.
А в проводнике увидел вот такую картину, система думает, что я просто зашел в каталог.
3. Теперь попробуем создать ссылку на файл, подменив ему имя.
Для этого создам файлик с именем 456.txt в корне диска D и введу вот такую команду в командной строке:
Эта команда создаст ссылку с именем test.txt в папке mk на диске C, которую система будет воспринимать как текстовый файл. А настоящий файл будет лежать на другом локальном диске.
Получается, что при обращение к символьной ссылке, система будет открывать и редактировать оригинальный файл.
На этом все, надеюсь данная статья оказалась вам полезной. Пишите комментарии с пожеланиями новых статей, подписывайтесь на канал. До свидания.
How to create symbolic links for multiple files in multiple folders using command prompt or power shell?
I have two main folders which have a lot of sub-folders in different drives. Have to create symbolic link for all files in the second folder into the first one.
Result using 2 commands:
How to make it for all files with a few commands instead of writing the code manually for each file?
PS: Firstly I wanted to use hard links but it seems it is not possible.
3 Answers 3
You can try something link this:
I believe this will fail if the same filename already exists in c:\folderc . So if you need to replace a file in c:\folderc with a symbolic link from d:\folderd , you need to extend it to remove the existing file.
UPDATE: This will only go down one level with the recurse option. It’s not the prettiest solution, but it should work.
other way. In a .bat file, i use this :
explanation : for /f . loop in a chosen dir with subfolders, %%i is the name of a file found with path (folder\subfolder\one_file.ext).
%%i
nxi is the name without path ( n ) and with extent ( x ). mklink créate the link for %%i It works. My question was different. In 2 computers, i can browse all the symbolic links (all the folders and subfolders) but in the third, not exactly. But with hard links, all is OK (with mklink /H ) Read the end of my question please. Thanks
PS: Firstly I wanted to use hard links but it seems it is not possible.
Hard links are only possible within the same filesystem: they cannot span different drives (including when using reparse points to avoid drive letters).
Second, «symbolic links» in Windows are a shell (ie. Windows Explorer) artefact. they will only work when applications make use of the shell namespace (which most do not).
How to create a link to a file, folder, or library on your computer
When you work with shared resources on a network, you may need to quickly get the link to a shared network folder and paste it into a chat window. Or, for example, you might want to know how to create a link to a file on your computer and use it to share that file with others on the same network. Although they are not easy to figure out, Windows gives us two ways to hyperlink a path to a file, folder, or library that’s shared on the network. Without further ado, here’s the answer to the “How do I copy a file path as a link?” question:
NOTE: This guide covers Windows 10 with May 2020 Update and Windows 7. Everything works the same in both operating systems. If you don’t know what your version of Windows is, read: What version of Windows do I have installed?.
Method 1: How to create a link to a file on your computer, using the Sharing Wizard (also works for hyperlinking folders or libraries)
When you share a file, folder, or library with the network, you can use the Sharing Wizard. This wizard is turned on by default, so you should have no problems starting it. To learn more about it, read this guide and follow it to share files, folders, or libraries: How to share folders, files, and libraries with the network, in Windows.
At the final step of the process, when the sharing wizard informs you that the file, folder, or library is shared, don’t close the wizard.
Look carefully beneath the “Your file/folder/library is shared” notification. There, Windows tells that “You can e-mail someone links to these shared items, or copy and paste the links into another app.”
If you click or tap the e-mail link, your default e-mail client is opened, and the direct link is automatically pasted into it.
If you press the “copy” link, the link to the shared resource is copied to the clipboard, and you can then paste it into other programs.
Method 2: How to create a link to a file on a shared drive, using File Explorer (also works for hyperlinking folders or libraries)
The second method applies to files, folders, and libraries that you’ve already shared on your Windows computer. If you’re wondering how to create a link to a file on a shared drive, this method works for that too.
Open File Explorer, go to the Network section, and double-click or double-tap on the PC where the file, folder, or library you want to link is found.
This shows you a list of all the folders that are shared with the network. Browse until you find the specific file, folder, or library for which you want the direct link.
Hold down Shift on your keyboard and right-click on the file, folder, or library for which you want a link. Then, select “Copy as path” in the contextual menu.
If you’re using Windows 10, you can also select the item (file, folder, library) and click or tap on the “Copy as path” button from File Explorer’s Home tab.
Then, paste the link into the app or document where you want it to be. You should have something similar to this:
For the folder, library, or file link(s) to be active, press Enter to make it clickable in the Office application where you copied it. When you Ctrl + click the link, File Explorer opens the shared file, folder, or library, if the network computer sharing that resource is available.
My file path link doesn’t work! Why?
In some cases, the file links you create might not work. There are several possible causes. Here’s what you can try:
Regardless of whether you wanted to create a link to a file, folder, or library, in some apps you might have to type “file://” before the network path, like this:
In other cases, depending on the apps in which you want to place the file links, you might also have to manually replace all the blank spaces in the link paths with this text: %20. Here’s an example:
There’s also the possibility that on some older versions of Windows, or in other operating systems, the backslashes from the network paths aren’t recognized. In that case, you can try to replace all the backslashes () with forward slashes (/).
Finally, note that, whatever you do, in some apps, file links simply don’t work as regular links. Such is the case with most web browsers and chat apps, which treat these local links as security threats. However, even so, the user who gets your file link can still use the link to get to that file, folder, or library. All he or she has to do is copy and paste the link in the address bar of (his or her) File Explorer and press Enter.
Do you use file hyperlinks?
We hope that you’ve found these tips useful. If you know other ways to generate the link to the files, folders, or libraries shared in a network, don’t hesitate to let us know. Comment below, and let’s share all the ways to generate links in Windows.