1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

The "JUNCTION" confusion with DIR at a command line

Discussion in 'Support' started by BobK, Jan 20, 2010.

  1. BobK

    Joined:
    Sep 11, 2009
    Messages:
    35
    Likes Received:
    0
    I'm sure I'm as confused as others with the forced use of JUNCTION'd directories.

    It began when I mistakenly ran TC and other programs in non-admin mode though I was an admin. Programs showed filesaves were succesful to the 'C:\' root.

    BUT a DIR from TC did not show the files?! Tried several times, several programs, same results. Those other programs could 'see' those files on the 'C:\' directory, but DIR from the TC command line did not?!!!

    How am I supposed to find a file that was MICROSOFT-misdirected to a different directory than I was told it DID go to?

    How should I run DIR to 'find' those files in the JUNCTIONed mis-direct(ory)?
    DIR Help (in TC) implies that DIR /T:J C:\ should work. It doesn't, it shows 'incorrect use'

    And what is '@Junction' in TC help? If I enter it at the cmd line, it's invalid..
     
  2. Joe Caverly

    Joined:
    Aug 28, 2009
    Messages:
    730
    Likes Received:
    8
    Hi,
    In essence, a junction is a symbolic link to a directory.

    To create a junction using TCC, I type;

    Code:
    mklink /j jlc "C:\Documents and Settings\jlc\My Documents"
    which returns;

    Junction created for jlc <<===>> C:\Documents and Settings\jlc\My Documents

    Instead of me having to type;

    Code:
    C:\Documents and Settings\jlc\My Documents
    
    I can instead just type;

    Code:
    C:\jlc
    
    Any files that I create, regardless of which directory that I created them in, will appear in the other directory. Note that C:\jlc is not a real directory, but a symbolic link to C:\Documents and Settings\jlc\My Documents

    This allows using C:\jlc from TCC, and from Windows Explorer.

    When I am in the root directory of my drive, and type DIR, I can see C:\JLC in the directory listing as follows;

    <junction>12/02/2009 7:59 <junction> JUNCTION jlc [C:\Documents and Settings\jlc\My Documents]</junction>

    You could also set the COLORDIR environment variable to make a junction "jump out" at you;

    </junction>
    Code:
    <junction></junction>set colordir=junction:red
    <junction>

    or whatever colour you prefer. Now when you do a DIR, your JUNCTION directories will be highlighted in red.

    When I do a DIR /T, one of the directories I see is;

    12/02/2009 7:59 JUNCTION <junction> ____D___L____ jlc [C:\Documents and Settings\jlc\My Documents]
    </junction>

    <junction>To just see the junctions, I type;

    </junction></junction>
    Code:
    <junction><junction></junction></junction>dir /A:L
    <junction><junction>

    Joe

    </junction></junction>
     
  3. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,374
    Likes Received:
    40
    Re: The &quot;JUNCTION&quot; confusion with DIR at a command line

    What exactly are you typing?
     
  4. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    Joe Caverly wrote:
    ...
    I have neither Vista, nor Win7 available here, so I cannot provide an
    explicit answer to the OP. However, I suspect that the "junctions" created
    have the HIDDEN or SYSTEM attribute, and become visible only if explicitly
    requested.
    An excellent explanation of "symbolic link" is found in Wikipedia at
    http://en.wikipedia.org/wiki/Symbolic_link.

    | To create a junction using TCC, I type;
    |
    | mklink /j jlc "C:\Documents and Settings\jlc\My Documents"
    |
    | which returns;
    |
    | *Junction created for jlc <<===>> C:\Documents and Settings\jlc\My
    | Documents*

    Note that the MKLINK command above inverted the parameter order of the
    older, but still available MKLNK command:

    MKLNK existing_directory junction_to_existing_directory

    or

    MKLNK existing_file hard_link_to_existing_file

    +++++++++++++++++++++++++++++++++++++++++++++

    The message from Joe to which I am responding here has arrived with many
    copies of HTML "tags" <junction> and </junction>. Viewing it in Outlook
    Express either as plain text or as HTML they do not disappear, probably
    because they are not really HTML tags.
    --
    Steve
     
  5. Joe Caverly

    Joined:
    Aug 28, 2009
    Messages:
    730
    Likes Received:
    8
    When I type;

    Code:
    echo %@junction[c:\jlc]
    at the command line, it returns;

    Code:
    C:\Documents and Settings\jlc\My Documents
    Please reference my previous reply to see how I created C:\jlc

    Joe
     
  6. jabelli

    Joined:
    Oct 29, 2008
    Messages:
    83
    Likes Received:
    0
  7. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    10,092
    Likes Received:
    85
    If you want to show junctions, you need to use /A:J. There is no /T:J
    option. (/T by itself will display the attributes of each directory entry,
    but it does not select them.)


    It's a variable function. You use it like any other variable function, as
    an argument to another command.

    Rex Conn
    JP Software
     
  8. Joe Caverly

    Joined:
    Aug 28, 2009
    Messages:
    730
    Likes Received:
    8
    Hi,
    I'm using TCC 11.00.38 Windows XP [Version 5.1.2600]
    TCC Build 38 Windows XP Build 2600 Service Pack 3

    In the help file, under Attribute Switches, it says that L is for Symbolic link or Junction (reparse point).

    I do not see the J attribute mentioned, yet both return the same result.

    Should this J option be included in the help file, or can I just not see it?

    Joe
     
  9. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    10,092
    Likes Received:
    85
    They're equivalent. The J option was the original, but the L option was
    added when Windows added symbolic link support. Microsoft added the /A:L
    option at that point, so I added it to TCC. The /A:J is deprecated but
    still supported for backward compatibility.

    Rex Conn
    JP Software
     
  10. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    Joe Caverly wrote:
    ...
    | I'm using TCC 11.00.38 Windows XP [Version 5.1.2600]
    | TCC Build 38 Windows XP Build 2600 Service Pack 3
    |
    | In the help file, under Attribute Switches, it says that L is for
    | Symbolic link or Junction (reparse point).
    |
    | I do not see the J attribute mentioned, yet both return the same
    | result.
    |
    | Should this J option be included in the help file, or can I just
    | not see it?
    J is accepted for backward compatibility. It is not used in reports. I
    see no need to include it in HELP. OTOH, we ought to update our batch files
    and aliases, but it is not trivial, and they would no longer work in older
    versions of JPsoft command processors.
    --
    HTH, Steve
     

Share This Page