VBScript Scripting Techniques > Shortcuts > Shortcuts
GetShortcut | |
---|---|
VBScript Code: | |
' Author: Denis St-Pierre ' *Retrieves* Shortcut info without using WMI ' The *Undocumented* Trick: use the ".CreateShortcut" method without the ' ".Save" method; works like a GetShortcut when the shortcut already exists! strTargetPath="C:\Documents and Settings\All Users\Desktop\My Shortcut.lnk" Set wshShell = CreateObject("WScript.Shell") ' CreateShortcut works like a GetShortcut when the shortcut already exists! Set objShortcut = wshShell.CreateShortcut(strTargetPath) ' For URL shortcuts, only ".FullName" and ".TargetPath" are valid WScript.Echo "Full Name : " & objShortcut.FullName WScript.Echo "Arguments : " & objShortcut.Arguments WScript.Echo "Working Directory : " & objShortcut.WorkingDirectory WScript.Echo "Target Path : " & objShortcut.TargetPath WScript.Echo "Icon Location : " & objShortcut.IconLocation WScript.Echo "Hotkey : " & objShortcut.Hotkey WScript.Echo "Window Style : " & objShortcut.WindowStyle WScript.Echo "Description : " & objShortcut.Description Set objShortcut = Nothing Set wshShell = Nothing |
|
Requirements: | |
Windows version: | any |
Network: | any |
Client software: | N/A |
Script Engine: | any |
Summarized: | Should work in any Windows version, with any script engine. |
[Back to the top of this page] |
page last modified: 2016-09-19; loaded in 0.0015 seconds