Fabien
Fabien

Reputation: 7049

How to get the target path of a shortcut in windows scripting?

From what I have read until now, you can get the TargetPath property of an objet of class Shortcut, which is the result of the method CreateShortcut of WScript.Shell.

But I have not found any way to get the target path of an existing shortcut.

Upvotes: 2

Views: 5643

Answers (2)

Fabien
Fabien

Reputation: 7049

In javascript:

var sh = WScript.CreateObject("WScript.Shell");
var sc = sh.CreateShortcut(shortcutPath);
var targePath = sc.TargetPath;

It took me some time to understand it. So I guess there will be at least one person happy to find the answer here.

Upvotes: 5

Related Questions