Forum Discussion
1 Reply
- PoidaOccasional Contributor
Thanks for the tips Robert. This is what I ended up with in case anyone else is looking for this later, in javascript
function Test_SCExists_GetSCPath() { if (!IsShortcutValid("Programs|Accessories|Paint", "|")) { Log.Error("Shortcut is not valid"); return; } Log.Message("Shortcut is valid"); var target = GetShortcutTarget("Programs|Accessories|Paint", "|"); if (!target) { Log.Error("Shortcut doesn't exist"); return; } Log.Message(target); } function IsShortcutValid(shortcutPath, separator) { var StartDir, path, shortcut; StartDir = "C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\"; path = shortcutPath.split(separator).join("\\") + ".lnk"; if (aqFileSystem.Exists(StartDir + path)) { shortcut = WshShell.CreateShortcut(StartDir + path); return aqFileSystem.Exists(shortcut.TargetPath); } return false; } function GetShortcutTarget(shortcutPath, separator) { var StartDir, path, shortcut; StartDir = "C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\"; path = shortcutPath.split(separator).join("\\") + ".lnk"; if (aqFileSystem.Exists(StartDir + path)) { shortcut = WshShell.CreateShortcut(StartDir + path); return shortcut.TargetPath; } return false; }