You can make C:\otherfolder\myotherfile.txt open the contents of C:\myfolder\myfile.txt by deleting the duplicate and creating a symbolic link in its place with mklink, using the new name first and the existing target second. The command in your attempt was reversed, requested a hard link with /h, and pointed at a name that still existed, so it could not succeed.
Create the redirect the right way
- Confirm the master is the keeper. Compare the two files and make sure
C:\myfolder\myfile.txtholds the version you want everyone to see going forward. - Clear the duplicate name. Move or delete
C:\otherfolder\myotherfile.txt.mklinknever merges or overwrites an existing file, so the link name must be free. - Open Command Prompt as administrator. Creating symbolic links requires elevated rights by default, or you can enable Developer Mode under Settings > Privacy & security > For developers to allow it for standard users.
- Create the link:
mklink "C:\otherfolder\myotherfile.txt" "C:\myfolder\myfile.txt"
The syntax is mklink Link Target. Do not add /D here, because the target is a file, not a directory. With no switch at all, mklink creates a file symbolic link. Once it reports success, double-clicking the old path in Explorer or opening it from any program resolves to the master file. No second copy of the data exists on disk.
Why you saw "Incorrect function"
Three separate problems were stacked in that one command, and they fail in different ways:
- The destination already existed. With both files present,
mklinkhas nowhere to put the link. That usually produces "Cannot create a file when that file already exists," which is why step 2 above matters. - The direction was backwards. As written, the command would have attached a link named
myfile.txtpointing at the duplicate — the exact opposite of the redirect you wanted. Swapping the arguments fixes the semantics, but on its own it does not explain the specific error message. - The location may not support links. "Incorrect function" typically appears when the underlying filesystem or path cannot host the operation: FAT32 or exFAT drives, network shares, and cloud placeholder files such as OneDrive's Files On-Demand all reject or mishandle link creation. Both paths should sit on a local NTFS volume, and a file that is really an online-only placeholder must be downloaded first.
Symbolic link or hard link: pick the tool that matches the goal
Your /h switch asked for a hard link, which is a different mechanism:
- A symbolic link is a pointer to a path. It is resolved every time the name is opened, it can span volumes, and it keeps working even if an application replaces the master with a freshly written file at the same location. This matches "open that other name, get the master file" almost exactly.
- A hard link is a second directory entry for the same file data. Both names are equals; there is no master and no target. Hard links are limited to a single volume and need no elevation, but if a program updates the master by deleting it and writing a new file (a common save technique), the hard-linked name silently keeps showing the old data. That divergence is exactly what a permanent redirect must avoid.
Hard links are fine for reclaiming space from true duplicates that never get replaced, but for path redirection the symbolic link is the correct choice.
Verify the link and keep it healthy
Run dir C:\otherfolder and you should see the entry flagged as <SYMLINK> with the target path beside it. In PowerShell, Get-Item exposes the LinkType and Target properties. A few habits will keep the arrangement stable:
- Deleting the linked name removes only the pointer, never the master's data.
- Deleting or moving the master breaks the link; the old path then fails to open until you recreate it or restore the file.
- Editing through either name edits the single shared content.
- Backup and sync tools may treat links differently from ordinary files, so test any backup routine before relying on it.
Related options worth knowing
PowerShell can create the same link without touching cmd:
New-Item -ItemType SymbolicLink -Path "C:\otherfolder\myotherfile.txt" -Target "C:\myfolder\myfile.txt"
If you ever need to redirect a whole folder, use mklink /D for a directory symbolic link or mklink /J for a junction, which needs no elevation. Regular shortcuts (.lnk files) are not a substitute here: they work only when double-clicked in Explorer, not when a program opens the path directly. Long term, the cleanest prevention is to keep one master file and link to it, rather than maintaining duplicate copies that drift apart.
Frequently Asked Questions
Do I really need an administrator prompt for this?
For symbolic links, yes, unless Developer Mode is enabled or your account has been granted the symbolic link privilege. Hard links and junctions can be created by standard users.
Can the link point across different drives?
A symbolic link can, since it only stores a path. A hard link cannot — both names must live on the same volume.
What if the file lives in a OneDrive folder?
Online-only placeholders are themselves reparse points and often refuse link operations. Right-click the file, choose "Always keep on this device," or keep linked files outside the synced folder.
Will deleting the linked file delete my master?
No. Deleting a symbolic link deletes only the link itself. The master file and its contents stay untouched.
What happens if I rename or move the master file?
The symbolic link stores the path, not the file, so it breaks until you either recreate the link or put the master back at the original path.
Why not just use a shortcut instead?
A shortcut is a small file that Explorer interprets on double-click. Applications that open the path directly — scripts, editors, import dialogs — bypass it entirely, while a symbolic link works at the filesystem level for everything.