Analyze a Windows shortcut

  • Russ Williams

    Russ Williams - 2003-10-08

    Is there a way to figure out what a Windows LNK file is a shortcut to in Regina or one of the auxiliary libraries?

    • Mark V

      Mark V - 2003-10-08

      It may be easiest to use a 3rd-party utility to dump the link contents.  Such as:  
      shortcut.exe /A:Q /F:<filename>       Such a shortcut utilility is available at    There is another (with different syntax) somewhere at Microsoft too.

      There is some shortcut functionality in Patrick McPhee's W32FUNCS package at   but I am not familiar with those functions.

      You could read in the file with CHARIN, but this would be my last choice (as it's "ugly" and UNICODE).  :-)

    • Russ Williams

      Russ Williams - 2003-10-09

      Thanks, Mark.  Shortcut.exe looks like it will do the job for me.  Do you know of anything that will translate Windows short names into long names?

      • Mark V

        Mark V - 2003-10-09

        Not in REXX that I know of...
        It might be nice is SysFileTree() or STREAM 'C' 'FSTAT' could...

        I am pursuing this in newsgroup:
        Post Subject:
        "FQ longnamepath from shortnamepath?"

        Where it is clear that shortcut.exe can be used to resolve the "expanded" FQP, but rather a kludge.  (W2K)

      • Robert A "Bob" Cruz

        You can use the following code to obtain the windows full path/file name from the short path/file name...

        full_name = STREAM( short_name, 'C', 'QUERY EXISTS' )

    • Mark V

      Mark V - 2003-10-10

      The newsgroup mentioned above contains (Win32) one solution using shortcut.exe, one VBS solution and two different Batch techniques.  There is also some discussion at newsgroup:
      in thread:
      "FQ short/longnamepaths (Win32, Regina)"

      And the possibility that a new function may be added to W32FUNCS soon.

      Thanks for the interesting question on resolving LongNamePaths from ShorNamePaths.  Learned something new.  :-)

    • Robert A "Bob" Cruz

      Just a note on my prior post:  it only works if the short file path/name is that of a file which exists.  If the file named does not exist, it will return an empty string.  In that case, you could write a single byte to it, then obtain the full path/name and erase it.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks