Adding "Find Target" Command

  • Thread starter Thread starter Ariel Morg
  • Start date Start date
A

Ariel Morg

Hi all...

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...

TIA
 
Ariel said:
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<----------------------
 
Ariel said:
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<----------------------
 
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
 
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
 
Hi all...

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...

TIA
Why aren't you right-clicking the shortcut, and clicking Target / Open
Container?


Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
 
Hi all...

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...

TIA
Why aren't you right-clicking the shortcut, and clicking Target / Open
Container?


Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
 
Very nice.

If you configure HKCR\lnkfile\shell\FindTarget\Command to invoke your script,
passing the %1 parameter for the .lnk file that was right-clicked,
it would be directly on lnk file context menus.


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<----------------------


Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
 
Very nice.

If you configure HKCR\lnkfile\shell\FindTarget\Command to invoke your script,
passing the %1 parameter for the .lnk file that was right-clicked,
it would be directly on lnk file context menus.


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<----------------------


Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
 
Hi again all.. :)

First of all , thanks alot to Torgeir for the awesome script !
I'm allmost there now , implemented the script in the send to and it works
just perfect :)

To Jerold

quote "Why aren't you right-clicking the shortcut, and clicking Target /
Open Container?"

I wish I had such an option , that's what I actually want , lol
Only way I know to do this is to click the properties first , which then
leaves an annoying properties window behind.

And the beat goes on....

Tried looking into the HKCR\lnkfile\shell\FindTarget\Command , but I got no
such path in the registry
Can only find HKCR\.lnk\ShellNew & HKCR\.lnk\ShellEx
Please advice further how to implement the script to the primary context
menu.

Thanks alot for all the help , you guyz rock ! :)

"MOTD.: The game of life sux , but it got awesome graphics.."
 
Hi again all.. :)

First of all , thanks alot to Torgeir for the awesome script !
I'm allmost there now , implemented the script in the send to and it works
just perfect :)

To Jerold

quote "Why aren't you right-clicking the shortcut, and clicking Target /
Open Container?"

I wish I had such an option , that's what I actually want , lol
Only way I know to do this is to click the properties first , which then
leaves an annoying properties window behind.

And the beat goes on....

Tried looking into the HKCR\lnkfile\shell\FindTarget\Command , but I got no
such path in the registry
Can only find HKCR\.lnk\ShellNew & HKCR\.lnk\ShellEx
Please advice further how to implement the script to the primary context
menu.

Thanks alot for all the help , you guyz rock ! :)

"MOTD.: The game of life sux , but it got awesome graphics.."
 
Jerold meant for you to create it.

--
Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

:
<snip>
| Tried looking into the HKCR\lnkfile\shell\FindTarget\Command , but I got
no
| such path in the registry
| Can only find HKCR\.lnk\ShellNew & HKCR\.lnk\ShellEx
| Please advice further how to implement the script to the primary context
| menu.
<snip>
 
Jerold meant for you to create it.

--
Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

:
<snip>
| Tried looking into the HKCR\lnkfile\shell\FindTarget\Command , but I got
no
| such path in the registry
| Can only find HKCR\.lnk\ShellNew & HKCR\.lnk\ShellEx
| Please advice further how to implement the script to the primary context
| menu.
<snip>
 
See tip 8336 » Add a 'Target / Open Container' to the right-click context menu
of your shortcuts?
in the 'Tips & Tricks' at http://www.jsiinc.com


Hi again all.. :)

First of all , thanks alot to Torgeir for the awesome script !
I'm allmost there now , implemented the script in the send to and it works
just perfect :)

To Jerold

quote "Why aren't you right-clicking the shortcut, and clicking Target /
Open Container?"

I wish I had such an option , that's what I actually want , lol
Only way I know to do this is to click the properties first , which then
leaves an annoying properties window behind.

And the beat goes on....

Tried looking into the HKCR\lnkfile\shell\FindTarget\Command , but I got no
such path in the registry
Can only find HKCR\.lnk\ShellNew & HKCR\.lnk\ShellEx
Please advice further how to implement the script to the primary context
menu.

Thanks alot for all the help , you guyz rock ! :)

"MOTD.: The game of life sux , but it got awesome graphics.."


Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
 
See tip 8336 » Add a 'Target / Open Container' to the right-click context menu
of your shortcuts?
in the 'Tips & Tricks' at http://www.jsiinc.com


Hi again all.. :)

First of all , thanks alot to Torgeir for the awesome script !
I'm allmost there now , implemented the script in the send to and it works
just perfect :)

To Jerold

quote "Why aren't you right-clicking the shortcut, and clicking Target /
Open Container?"

I wish I had such an option , that's what I actually want , lol
Only way I know to do this is to click the properties first , which then
leaves an annoying properties window behind.

And the beat goes on....

Tried looking into the HKCR\lnkfile\shell\FindTarget\Command , but I got no
such path in the registry
Can only find HKCR\.lnk\ShellNew & HKCR\.lnk\ShellEx
Please advice further how to implement the script to the primary context
menu.

Thanks alot for all the help , you guyz rock ! :)

"MOTD.: The game of life sux , but it got awesome graphics.."


Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
 
Back
Top