Click here to Skip to main content
15,885,757 members
Articles / Operating Systems / Windows

Using One File via Two Folders: SymLinks to the Rescue

Rate me:
Please Sign up or sign in to vote.
4.65/5 (8 votes)
17 Jul 2019CPOL3 min read 12.6K   11   11
I finally discovered a reliable way to use the same file from two or more directories.


How often have you wanted to have access to the same file from two or more directories (folders)? Of course, it has always been possible to do so via a desktop shortcut (.LNK) file, and those are good as far as they go, but they hide important information, such as when the file to which they point was last updated.


Frequently, I create a file in one directory, such as the notes associated with an active development project. However, I often need access to the same file from other locations, such as the notes directory associated with a library upon which the project depends. When such a case arose a while ago, I took the opportunity to apply my recently acquired knowledge about how symbolic links work in Windows. 

Recent Windows versions, starting with Vista, I believe, include mklink.exe a command line system utility similar to fsutil.exe, which predates it by several Windows iterations. Unlike mklink.exe, the links created by fsutil.exe break when you save an update, leaving copies of the old version in place of each of is hard links.

Using the code

Do the following.

  1. Use the File Explorer (Windows Explorer) to navigate to the directory where you created the original file.
  2. Select (highlight) the original file.
  3. Use the Copy Path tool on the Home tab to deposit a copy of the fully-qualified file name onto the Windows Clipboard. Since the File Explorer always quotes this string, it is guaranteed to work in a command.
  4. Navigate to the directory where you want to create the symbolic link.
  5. Enter cmd into the address bar, and press the Enter key. This creates a command prompt window with its working directory set to the directory in the active File Explorer window.
  6. Enter the following command to create your symbolic link.
mklink [SymLinkName] [AbsoluteSourceFileName]

In the above command:

  • SymLinkName is the name by which the link will be known in the destination directory. Enter a name and extension, but omit any path.
  • AbsoluteSourceFileName is the absolute (fully qualified) path to the original file. This is the text that you copied into the clipboard in step 3. Hit Ctrl-V to paste it into the command window.

Following is an example that creates a symbolic link, Default_Event_Source_ID_Missing.TXT, in directory F:\Source_Code\Visual_Studio\Projects\WizardWrx_Libs\WizardWrx_NET_API\_NOTES to F:\Source_Code\Visual_Studio\Projects\GUI_Apps\CountDownClock\NOTES\Default_Event_Source_ID_Missing.TXT.

F:\Source_Code\Visual_Studio\Projects\WizardWrx_Libs\WizardWrx_NET_API\_NOTES 2019/07/15 11:46:02.34>mklink Default_Event_Source_ID_Missing.TXT F:\Source_Code\Visual_Studio\Projects\GUI_Apps\CountDownClock\NOTES\Default_Event_Source_ID_Missing.TXT
symbolic link created for Default_Event_Source_ID_Missing.TXT <&kt;<===>> F:\Source_Code\Visual_Studio\Projects\GUI_Apps\CountDownClock\NOTES\Default_Event_Source_ID_Missing.TXT

Points of Interest

Though the syntax of mklink.exe and fsutil.exe are almost idetical, mklink.exe works in any command prompt windows, while fsutil.exe needs an elevated prompt. Save the elevator for when you need it.


Monday, 15 July 2019 is the publication date.

Tuesday, 16 July 2019, while reviewing changes made by an editor, of which I was just notified by email, it came to my attention that there were a few formatting and typographical errors that escaped my notice yesterday.

Wednesday, 17 July 2019, while reviewing my own changes after they were posted, I found another typographical error, and took the opportunity to clarify that File Explorer is another name for Windows Explorer.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Written By
Software Developer (Senior)
United States United States
I deliver robust, clean, adaptable, future-ready applications that are properly documented for users and maintainers. I have deep knowledge in multiple technologies and broad familiarity with computer and software technologies of yesterday, today, and tomorrow.

While it isn't perceived as sexy, my focus has always been the back end of the application stack, where data arrives from a multitude of sources, and is converted into reports that express my interpretation of The Fundamental Principle of Tabular Reporting, and are the most visible aspect of the system to senior executives who approve the projects and sign the checks.

While I can design a front end, I prefer to work at the back end, getting data into the system from outside sources, such as other computers, electronic sensors, and so forth, and getting it out of the system, as reports to IDENTIFY and SOLVE problems.

When presented with a problem, I focus on identifying and solving the root problem for the long term.

Specialties: Design: Relational data base design, focusing on reporting; organization and presentation of large document collections such as MSDS libraries

Development: Powerful, imaginative utility programs and scripts for automated systems management and maintenance

Industries: Property management, Employee Health and Safety, Services

Languages: C#, C++, C, Python, VBA, Visual Basic, Perl, WinBatch, SQL, XML, HTML, Javascript

Outside Interests: Great music (mostly, but by no means limited to, classical), viewing and photographing sunsets and clouds, traveling by car on small country roads, attending museum exhibits (fine art, history, science, technology), long walks, especially where there is little or no motor traffic, reading, especially nonfiction and thoughtfully written, thought provoking science fiction

Comments and Discussions

QuestionPermission problem? Pin
AchLog19-Jul-19 0:28
AchLog19-Jul-19 0:28 
AnswerRe: Permission problem? Pin
Member 1084629621-Jul-19 20:10
Member 1084629621-Jul-19 20:10 
GeneralRe: Permission problem? Pin
Member 1084629621-Jul-19 22:36
Member 1084629621-Jul-19 22:36 
QuestionFile Explorer? Pin
gggustafson16-Jul-19 5:36
mvagggustafson16-Jul-19 5:36 
AnswerRe: File Explorer? Pin
David A. Gray16-Jul-19 10:11
David A. Gray16-Jul-19 10:11 
GeneralWhat about hard links? Pin
Daniele Rota Nodari16-Jul-19 3:19
Daniele Rota Nodari16-Jul-19 3:19 
GeneralRe: What about hard links? Pin
gggustafson16-Jul-19 5:34
mvagggustafson16-Jul-19 5:34 
GeneralRe: What about hard links? Pin
Daniele Rota Nodari16-Jul-19 6:14
Daniele Rota Nodari16-Jul-19 6:14 
GeneralRe: What about hard links? Pin
gggustafson16-Jul-19 6:35
mvagggustafson16-Jul-19 6:35 
GeneralRe: What about hard links? Pin
David A. Gray16-Jul-19 10:26
David A. Gray16-Jul-19 10:26 
GeneralRe: What about hard links? Pin
Daniele Rota Nodari17-Jul-19 23:12
Daniele Rota Nodari17-Jul-19 23:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.