Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: MKLINK Create and Use Links in Windows

10 Jul 2015   #90
kado897

Microsoft Community Contributor Award Recipient

Microsoft Windows 7 Home Premium 64-bit Service Pack 1
 
 

have you tried mklink /h <absolute path to the link file name> <absolute path to the real file>

e.g. mklink /h C:\test\foobar.exe "C:\Program Files\foobar.exe" where c:\test exists and "c:\Program Files\foobar.exe" exists and is the real file.


My System SpecsSystem Spec
.
10 Jul 2015   #91
kado897

Microsoft Community Contributor Award Recipient

Microsoft Windows 7 Home Premium 64-bit Service Pack 1
 
 

Here is an illustrated example on an image file.

Both folders exist

-2015-07-10-001.png

Fox is populated with images

-2015-07-10-002.png

Link is empty.

-2015-07-10-003.png

The MKLINK command.

-2015-07-10-004.png

Image1 is in Link as a hard link.

-2015-07-10-005.png


My System SpecsSystem Spec
10 Jul 2015   #92
JerometheGiraff

Windows 10 Pro
 
 

Quote:
have you tried mklink /h <absolute path to the link file name> <absolute path to the real file>

e.g. mklink /h C:\test\foobar.exe "C:\Program Files\foobar.exe" where c:\test exists and "c:\Program Files\foobar.exe" exists and is the real file.
mklink /h <absolute path to the linked file name> <absolute path to the real file>
The syntax of the command is incorrect ?
My System SpecsSystem Spec
10 Jul 2015   #93
kado897

Microsoft Community Contributor Award Recipient

Microsoft Windows 7 Home Premium 64-bit Service Pack 1
 
 

Quote   Quote: Originally Posted by JerometheGiraff View Post
Quote:
have you tried mklink /h <absolute path to the link file name> <absolute path to the real file>

e.g. mklink /h C:\test\foobar.exe "C:\Program Files\foobar.exe" where c:\test exists and "c:\Program Files\foobar.exe" exists and is the real file.
mklink /h <absolute path to the linked file name> <absolute path to the real file>
The syntax of the command is incorrect ?
See my worked example above.
My System SpecsSystem Spec
.

10 Jul 2015   #94
Pyprohly

Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
 
 

Quote   Quote: Originally Posted by GokAy View Post
Symbolic links turn into normal folders with copies of contents of the linked folder when copied to another place. Is there a way to avoid this? Learned this while we had a discussion in a thread recently.
(About that "recent discussion", GokAy, sorry for ever being unreasonable, if I was. I'm just a lil stickler for what I believe are best practises. When you offered your method to the solution I decided it was too similar to mine for ease. Everything I've said there was only said so in an attempt to promote my own method)

I don't think the fact that "symbolic link's targets are followed when they're copied" is an intentional hit by design. I think that it is more of just a 'happening' that a folder-symbolic-link's contents are copied instead of the link itself, to be specific, I think Explorer is tricked into thinking the symbolic link is the real folder.

And that's the true reason why one would want to use these symbolic links, or hard links, or junctions over the standard Shortcut files in the first place anyway: to trick applications into thinking that the link is the actual target itself.

To answer the question of "Is there a way to avoid this?", as Relative's page indicates, it's easier to just re-create the links.


Quote   Quote: Originally Posted by JerometheGiraff View Post
I'm going to reiterate. I want to create a symbolic link whereas I create a symbolic link to a file, when the file in the symbolic link location gets updated, or the original location, either way both files get updated. In laymen terms, the file in the original location gets cloned; when I save the file in the cloned location, both the cloned file and the location of the original file get updated.
Your intent isn't much clearer to me. But it does sound like you want a hard link.

Quote   Quote: Originally Posted by JerometheGiraff View Post
The above command is not working ?
What command is not working? Jerome, I plead you post here the *exact* command line that falls short of your expectations. IOW, what exactly are you typing at the Command Prompt to receive such error as you described before?

Bloating the thread with "[insert Mklink command syntax here] isn't working" isn't going to get you far. It helps when additional information is provided, where ever possible.
My System SpecsSystem Spec
10 Jul 2015   #95
JerometheGiraff

Windows 10 Pro
 
 

Quote:
mklink /d C:\my files\afiletolong C:\User\graple\preferences-sets
This is the command I'm using ?
My System SpecsSystem Spec
10 Jul 2015   #96
JerometheGiraff

Windows 10 Pro
 
 

I have a few questions, I copy the file for which I want to make a hard link to the folder to which I want to make a hard link, connect, correct ? In other words, if the original location of the file is in C:\Users\acme\one; I want to make a hard link, I copy the file for which was in C:\Users\acme\one to C:\1 then run this command;

mklink /h C:\Users\acme\one C:\1 ?

If that is correct, why am I getting command errors ? Contrary to what one may believe, regardless if I post the exact file path; it won't help if what I'm doing is correct and it doesn't work, you can argue it will, but I'm not trying to type code; it's a straight forward command.
My System SpecsSystem Spec
10 Jul 2015   #97
Pyprohly

Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
 
 

Quote   Quote: Originally Posted by JerometheGiraff View Post
mklink /d C:\my files\afiletolong C:\User\graple\preferences-sets
There's one problem, remember to quote paths with spaces in them. Quote all paths regardless.

I don't know what "C:\my files\afiletolong" or "C:\User\graple\preferences-sets" is, so I cannot tell if the command line is valid or not, yet.


Quote   Quote: Originally Posted by JerometheGiraff View Post
I have a few questions, I copy the file for which I want to make a hard link to the folder to which I want to make a hard link, connect, correct ? In other words, if the original location of the file is in C:\Users\acme\one; I want to make a hard link, I copy the file for which was in C:\Users\acme\one to C:\1 then run this command
Please don't say, "I need a blah link", specifically, because you'll make the mistake of saying, for example, "I need a hard link to a folder" which is impossible: hard links to folders are not supported under any NTFS standard.

Jerome, just tell us want you want linked to what, and we'll create the command line for you.


Quote   Quote: Originally Posted by JerometheGiraff View Post
If that is correct, why am I getting command errors ?.
If you are getting errors, obviously what you are typing isn't correct.

I can, however, tell you the conditions that must be satisfied prior to running
Code:
mklink /h C:\Users\acme\one C:\1
for it to be valid:
  • The folder "C:\Users\acme" must exist,
  • The path "C:\Users\acme\one" must not exist,
  • The folder "C:\1" must exist as a file.

Quote   Quote: Originally Posted by JerometheGiraff View Post
Contrary to what one may believe, regardless if I post the exact file path; it won't help if what I'm doing is correct and it doesn't work, you can argue it will, but I'm not trying to type code; it's a straight forward command.
And it should be. I wanted you to post the exact command you are attempting in order to allow for us to spot minor mistakes such as un-quoted paths, or incorrect use of relative paths, etc. You've posted many lines of command here, I'm just so confused.
My System SpecsSystem Spec
11 Jul 2015   #98
kado897

Microsoft Community Contributor Award Recipient

Microsoft Windows 7 Home Premium 64-bit Service Pack 1
 
 

Quote   Quote: Originally Posted by JerometheGiraff View Post
I have a few questions, I copy the file for which I want to make a hard link to the folder to which I want to make a hard link, connect, correct ? In other words, if the original location of the file is in C:\Users\acme\one; I want to make a hard link, I copy the file for which was in C:\Users\acme\one to C:\1 then run this command;

mklink /h C:\Users\acme\one C:\1 ?

If that is correct, why am I getting command errors ? Contrary to what one may believe, regardless if I post the exact file path; it won't help if what I'm doing is correct and it doesn't work, you can argue it will, but I'm not trying to type code; it's a straight forward command.
No. You do not copy anything anywhere. In your example if the original file is c:\users\acme\one\xxx.yyy then the command is.

mklink /h c:\1\xxx.yyy c:\users\acme\one\xxx.yyy

Note the order of the parameters.

The folder c:\1 must exist but must NOT contain a copy of xxx.yyy
My System SpecsSystem Spec
12 Jul 2015   #99
JerometheGiraff

Windows 10 Pro
 
 

It worked.
My System SpecsSystem Spec
Comment

 MKLINK Create and Use Links in Windows




Tutorial Tools Search this Tutorial
Search this Tutorial:

Advanced Search




Similar help and support threads
Windows 7 Tutorial Category
MKLINK, HIBERFIL.SYS amd SSD space
I have two drives, an SSD for the OS (C:) and a platter drive for data (D:). I want to be able to hibernate my PC but don't want HIBERFIL to wear out my SSD as I have lots of memory (24GB) being written to the SSD every time I hibernate. Can anyone please advise me whether it's possible to move...
General Discussion
MKLINK - Can not create what is already there
Not correct sentence but it is original in Swedish. Because i am not a fan of printscreen, so i will post what i have written: C:\Windows\system32>mklink /d "C:\Users\Susanne\AppData\Local\Opera Software\Ope ra Stable" "E:\" I am not really shure about the differens between "j" and "d",...
General Discussion
Create Skydrive share links within file explorer
I'm using skydrive often and I really like it. I also Like the Feature that I can send a link to my friends so that they can download the file. Unfortunately I always need to login on the Web Interface to create the link - with a lot of clicks. Is there a way to create this link directly from...
Software
Links Library - Create
How to Create a "Links" Library with Correct Icon in Windows 7 and Windows 8 This will show you how to create a Links library that has the correct Links folder icon on a glass plate for it's library icon in Windows 7 and Windows 8. The included folder C:\Users\(user-name)\Links is also the...
Tutorials
How to create my own folder links in the Start Menu
On the right hand side you have buttons (User, Pictures, Music, Video,etc) that I don't want/use. Would like to change some of these for my needs. Played around with it a bit but without luck. How do I do this?
Customization


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 23:31.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App