Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: How to get URL associated with an existing Windows URL shortcut?

by Discipulus (Canon)
on Aug 03, 2023 at 09:19 UTC ( [id://11153682] : note . print w/replies, xml ) Need Help??


in reply to How to get URL associated with an existing Windows URL shortcut?

Hello cormanaz,

ikegami++ code works both for .link and .url files, but they are different: the first one contains binary data (but it seems that the final path is still human redable) while the second one is a plain text file:

perl -lne "print if s/URL=//" Perlmonks.url https://perlmonks.org/

L*

There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

Replies are listed 'Best First'.
Re^2: How to get URL associated with an existing Windows URL shortcut?
by cormanaz (Deacon) on Aug 03, 2023 at 14:15 UTC
    Ah well now that I know this, I won't mess around with these mods, I'll just open the file and get the URL. Thanks!
      If this is long-lived code, I would still use the Win32::OLE module. You never know when the internals of the file structure will change, and then your regex trick stops working.

      But, if you're just making quick scripts to get work done, then yeah do it whichever way is fastest.