fun with shortcut .lnk files

Started by kdmoyers, August 14, 2024, 05:22:44 AM

Previous topic - Next topic

kdmoyers

I needed my program to follow a possible shortcut .lnk redirection, and was pleased to find that Winbatch has my back with the ShortCutInfo function:

   ;=== address the possibility that param1 is actually a Windows "shortcut" file ===
   errormode(@off)
   scinfo = shortcutinfo(param1)         ; attempt to interpret as a "shortcut"
   errormode(@on)
   if itemcount(scinfo,@tab)>1            ; is a list?
      display(1,"shortcut redirecting From",param1)
      param1 = itemextract(1,scinfo,@tab)   ; 1st element is target filename
      display(2,"shortcut redirecting To",param1)
   endif
The mind is everything; What you think, you become.