MKLINK – Create and Use Links in Windows

Page 10 of 16 FirstFirst ... 89101112 ... LastLast

  1. Posts : 10,455
    Microsoft Windows 7 Home Premium 64-bit Service Pack 1
       #90

    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 Computer


  2. Posts : 10,455
    Microsoft Windows 7 Home Premium 64-bit Service Pack 1
       #91

    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 Computer


  3. Posts : 925
    Windows 10 Pro
       #92

    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 Computer


  4. Posts : 10,455
    Microsoft Windows 7 Home Premium 64-bit Service Pack 1
       #93

    JerometheGiraff said:
    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 Computer


  5. Posts : 721
    Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
       #94

    GokAy said:
    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.


    JerometheGiraff said:
    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.

    JerometheGiraff said:
    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 Computer


  6. Posts : 925
    Windows 10 Pro
       #95

    mklink /d C:\my files\afiletolong C:\User\graple\preferences-sets
    This is the command I'm using ?
      My Computer


  7. Posts : 925
    Windows 10 Pro
       #96

    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 Computer


  8. Posts : 721
    Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
       #97

    JerometheGiraff said:
    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.


    JerometheGiraff said:
    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.


    JerometheGiraff said:
    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.


    JerometheGiraff said:
    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 Computer


  9. Posts : 10,455
    Microsoft Windows 7 Home Premium 64-bit Service Pack 1
       #98

    JerometheGiraff said:
    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 Computer


  10. Posts : 925
    Windows 10 Pro
       #99

    It worked. :)
      My Computer


 
Page 10 of 16 FirstFirst ... 89101112 ... LastLast

  Related Discussions
Our Sites
Site Links
About 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 10:14.
Find Us