Native Path of Shortcut target?

Is there a way to retrieve the native pathname of the target of a shortcut? In my case below, Eclipse is actually a shortcut to a path under C:\Program Files, not under C:\Program Files (x86); but I can’t find a usage of “shortcuts” that gives me the native path.

q: pathnames of shortcuts of files "C:\ProgramData\Start Menu\Programs\Eclipse\Eclipse-3.6.2-win32-x86_64.lnk"
A: C:\Program Files (x86)\Eclipse-3.6.2\eclipse\eclipse.exe
T: 0.795 ms

Try:

pathnames of shortcuts of x64 files "C:\ProgramData\Start Menu\Programs\Eclipse\Eclipse-3.6.2-win32-x86_64.lnk"

Oddly enough, no joy.

q: pathnames of shortcuts of x64 files "C:\ProgramData\Start Menu\Programs\Eclipse\Eclipse-3.6.2-win32-x86_64.lnk"

A: C:\Program Files (x86)\Eclipse-3.6.2\eclipse\eclipse.exe
T: 0.882 ms

1 Like

Q:

lines of files "C:\ProgramData\Start Menu\Programs\Eclipse\Eclipse-3.6.2-win32-x86_64.lnk"

A: ???

Looks like it’s binary-encoded, doubt it’ll post correctly here, but here goes:

q: lines of files "C:\ProgramData\Start Menu\Programs\Eclipse\Eclipse-3.6.2-win32-x86_64.lnk"

A: L%00%00%00%01%14%02%00%00%00%00%00%c0%00%00%00%00%00%00F%8b%00%00%00 %00%00%00%e2U_%bd%04%d1%ce%01%e2U_%bd%04%d1%ce%01%aa%a4j%03%d0%06%cd%01%00%aa%00%00%00%00%00%00%01%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%c9%01%14%00%1fP%e0O%d0 %ea:i%10%a2%d8%08%00+00%9d%19%00/C:%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%88%001%00%00%00%00%00XCQ%b0%11%00PROGRA~1%00%00p%00%08%00%04%00%ef%be%ee:%85%1aXCQ%b0*%00%00%00%fd%04%00%00%00%00%01%00%00%00%00%00%00%00%00%00F%00%00%00%00%00P%00r%00o%00g%00r%00a%00m%00 %00F%00i%00l%00e%00s%00%00%00@%00s%00h%00e%00l%00l%003%002%00.%00d%00l%00l%00,%00-%002%001%007%008%001%00%00%00%18%00b%001%00%00%00%00%00XCQ%b0%10%00ECLIPS~1.2%00%00H%00%08%00%04%00%ef%beXCQ%b0XCQ%b0*%00%00%00/e%03%00%00%00%02%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00E%00c%00l%00i%00p%00s%00e%00-%003%00.%006%00.%002%00%00%00%1a%00R%001%00%00%00%00%00XCj%b0%10%00eclipse%00<%00%08%00%04%00%ef%beXCQ%b0XCj%b0*%00%00%001e%03%00%00%00%01%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00e%00c%00l%00i%00p%00s%00e%00%00%00%16%00^%002%00%00%aa%00%00t@%e8%9b %00eclipse.exe%00D%00%08%00%04%00%ef%beXCQ%b0XCQ%b0*%00%00%007e%03%00%00%00%01%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00e%00c%00l%00i%00p%00s%00e%00.%00e%00x%00e%00%00%00%1a%00%00%00g%00%00%00%1c%00%00%00%01%00%00%00%1c%00%00%003%00%00%00%00%00%00%00f%00%00%00%17%00%00%00%03%00%00%00%b6%1b%fb%b4%10%00%00%00OSDisk%00C:\Program Files\Eclipse-3.6.2\eclipse\eclipse.exe%00%00A%00.%00.%00%00.%00.%00%00.%00.%00%00.%00.%00%00.%00.%00%00.%00.%00%00P%00r%00o%00g%00r%00a%00m%00 %00F%00i%00l%00e%00s%00%00E%00c%00l%00i%00p%00s%00e%00-%003%00.%006%00.%002%00%00e%00c%00l%00i%00p%00s%00e%00%00e%00c%00l%00i%00p%00s%00e%00.%00e%00x%00e%00%10%00%00%00%05%00%00%a0&%00%00%00%b5%00%00%00%1c%00%00%00%0b%00%00%a0%b6c^%90%bf%c1NI%b2%9ce%b72%d3%d2%1a%b5%00%00%00M%00%00%00%09%00%00%a0A%00%00%001SPS%e2%8aXF%bcL8C%bb%fc%13%93&%98m%ce%25%00%00%00%04%00%00%00%00%1f%00%00%00%09%00%00%00S%00-%001%00-%005%00-%001%008%00%00%00%00%00%00%00%00%00%00%00%00%00`%00%00%00%03%00%00%a0X%00%00%00%00%00%00%00ndjsmsdwtst03%00%00%00%de%9f%12}%97%c1%8dI%b2%17$-%86%ecB%fd/r%abo%f6<%e3%11%a3
A: %00PV%94b%07%de%9f%12}%97%c1%8dI%b2%17$-%86%ecB%fd/r%abo%f6<%e3%11%a3
A: %00PV%94b%07%00%00%00%00

Not Binary. That is Unicode.

(concatenations of characters whose (it != "%00") of it) of lines of files "C:\ProgramData\Start Menu\Programs\Eclipse\Eclipse-3.6.2-win32-x86_64.lnk"

The answer is in there, I can see it.

Also, This seems like a bug. The shortcut inspector should return the contents of the LNK file, not it’s SysWOW interpretation of it. Maybe it is using some sort of WinAPI?

Quite right, I should have said “unprintable”.
I’m still not happy with the prospect of parsing out

q: (concatenations of characters whose (it != "%00") of it) of lines of files "C:\ProgramData\Start Menu\Programs\Eclipse\Eclipse-3.6.2-win32-x86_64.lnk"
A: L%01%14%02%c0F%8b %e2U_%bd%04%d1%ce%01%e2U_%bd%04%d1%ce%01%aa%a4j%03%d0%06%cd%01%aa%01%c9%01%14%1fP%e0O%d0 %ea:i%10%a2%d8%08+00%9d%19/C:\%881XCQ%b0%11PROGRA~1p%08%04%ef%be%ee:%85%1aXCQ%b0*%fd%04%01FProgram Files@shell32.dll,-21781%18b1XCQ%b0%10ECLIPS~1.2H%08%04%ef%beXCQ%b0XCQ%b0*/e%03%02Eclipse-3.6.2%1aR1XCj%b0%10eclipse<%08%04%ef%beXCQ%b0XCj%b0*1e%03%01eclipse%16^2%aat@%e8%9b eclipse.exeD%08%04%ef%beXCQ%b0XCQ%b0*7e%03%01eclipse.exe%1ag%1c%01%1c3f%17%03%b6%1b%fb%b4%10OSDiskC:\Program Files\Eclipse-3.6.2\eclipse\eclipse.exeA..\..\..\..\..\..\Program Files\Eclipse-3.6.2\eclipse\eclipse.exe%10%05%a0&%b5%1c%0b%a0%b6c^%90%bf%c1NI%b2%9ce%b72%d3%d2%1a%b5M%09%a0A1SPS%e2%8aXF%bcL8C%bb%fc%13%93&%98m%ce%25%04%1f%09S-1-5-18`%03%a0Xndjsmsdwtst03%de%9f%12}%97%c1%8dI%b2%17$-%86%ecB%fd/r%abo%f6<%e3%11%a3
A: PV%94b%07%de%9f%12}%97%c1%8dI%b2%17$-%86%ecB%fd/r%abo%f6<%e3%11%a3
A: PV%94b%07
T: 7.937 ms

What do you need this for?

Can’t you just get this info from the InstallLocation in the Uninstall Key of the registry?

What about in Registered Applications?

I’m dealing with an older OS image we have, where Eclipse was “installed” by unzipping it into one or both of Program Files and Program Files (x86).

I want to have a task that identifies cases where Eclipse was extracted, but no shortcuts to it were created on the Start Menu; when I find such cases I want to create new shortcuts.

I’ve just about resigned myself to checking for an expected pattern in the names of the shortcut files, but I would have preferred to look at the shortcut targets.

1 Like
(preceding texts of firsts "%00%00" of following texts of firsts "OSDisk%00" of it) of lines whose(it contains "OSDisk%00" AND it contains "%00%00") of files "C:\ProgramData\Start Menu\Programs\Eclipse\Eclipse-3.6.2-win32-x86_64.lnk"

Why couldn’t you just install Eclipse if the shortcut is missing?

You could dynamically find Eclipse, then dynamically check for the existence of shortcuts. You could assume that if Eclipse exists and a shortcut for Eclipse exists, then you are probably good to go.

Yeah, I may have to handle it that way.

Relevance 0:

windows of operating system

Relevance 1:

exists folders whose(name of it as lowercase starts with "eclipse") of folders whose(name of it as lowercase starts with "program files") of folders "C:"

Relevance 2:

not exists files whose(name of it as lowercase starts with "eclipse" AND name of it as lowercase ends with ".lnk") of folders "C:\ProgramData\Start Menu\Programs\Eclipse"

Yeah, the problem I encounter is where there are both x32 and x64 installations of Eclipse, but only 0 or 1 shortcuts.

I think I’m going to have to go with shortcut names; or just recreated shortcuts for all Eclipse installations regardless of prior shortcut states and tattoo the system.

You can count the number of eclipse shortcuts and the number of eclipse folders.