Very cool Torgeir
--
Regards,
Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect
:
| Ariel Morg wrote:
|
| > I frequently find original file locations by right clicking shortcut to
the
| > file , choosing properties , then clicking the "Find Target" button.
| > Anyone knows if it's possible to get this option available directly on
the
| > right click menu , and if so how ?
| > Any help apreciated...
| Hi
|
| Using a VBScript, you can at least get this functionality using
| right click / Send To.
|
|
| Do like this:
|
| Create a file called e.g. "Find Link Target.vbs" containing the script
| below and create a shortcut to it in the SendTo folder (or just put
| the file itself in the SendTo folder, but then you will see the .vbs
| extension, at least if you have set Explorer to show file extensions).
|
| This way, you can right click a link file in Explorer, use the SendTo
| selection "Find Link Target".
|
| To open the SendTo folder to put your script shortcut into, run this
| from the Start\Run menu (include the quotes!):
|
| "%USERPROFILE%\SendTo"
|
|
|
| Find Link Target.vbs.vbs:
|
| '--------------------8<----------------------
|
| sTitle = "Find Target"
|
| Set oArgs = WScript.Arguments
| If oArgs.Count <> 1 Then
| ErrMsgAndQuit
| End If
|
| sFile = oArgs(0)
|
| Set oShell = CreateObject("WScript.Shell")
| Set oFSO = CreateObject("scripting.FileSystemObject")
|
| If Not oFSO.FileExists(sFile) Then
| ErrMsgAndQuit
| Elseif Not LCase(oFSO.GetExtensionName(sFile)) = "lnk" Then
| ErrMsgAndQuit
| End If
|
| sTarget = oShell.CreateShortcut(sFile).TargetPath
|
| ' Launching Explorer with command line switches, more here:
| '
| ' Windows Explorer Command-Line Options
| '
http://support.microsoft.com/?kbid=152457
|
| If oFSO.FolderExists(sTarget) Then
| oShell.Run "explorer.exe /n, /e, " & sTarget
| Elseif oFSO.FileExists(sTarget) Then
| oShell.Run "explorer.exe /n, /e, /select," & sTarget
| Else
| MsgBox "No file or folder found in shortcut target path!", _
| vbInformation + vbSystemModal, sTitle
| End If
|
|
| Sub ErrMsgAndQuit
| MsgBox "Error: You need to supply one shortcut file " _
| & "as input parameter!", vbInformation + vbSystemModal, sTitle
| Wscript.Quit
| End Sub
|
| '--------------------8<----------------------
|
|
| --
| torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
| Administration scripting examples and an ONLINE version of
| the 1328 page Scripting Guide:
|
http://www.microsoft.com/technet/scriptcenter/default.mspx