IShellLink

why can’t we copy path of target from .lnk shortcut. I tried with following script doesnt work. If we look at the shortcut properties it shows the path just wont let copy it.

CreateShortcut Method

var WshShell = new ActiveXObject("WScript.Shell");
strDesktop = WshShell.SpecialFolders("Desktop");
var oShellLink = WshShell.CreateShortcut("C:\Documents and Settings\user1\Desktop\to haven.lnk");
WScript.Echo(oShellLink.TargetPath);
WScript.Echo(oShellLink.Description);

sysinternals strings came to rescue.

C:\> strings "C:\Documents and Settings\user1\Desktop\to haven.lnk"

prints the target path.

Shell Links

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s