Help - Search - Members - Calendar
Full Version: Add 'Find Target' to Right Click...
MSFN Forums > Customizing Windows and Graphics > Windows Tips 'n' Tweaks

   
Google Internet Forums Unattended CD/DVD Guide
Oh_Kay
Hi guys,

Im looking for a way to add the 'find target' command to my 'right click / contextual menu' in windows XP SP2, Im all googled out and can't find jack on the subject of this particular mod...

Anyone out there come across that one ? or can you suggest a way I may find it using RegShot or what ever that app is called ?

Any help is appreciated.

Kay
maxXPsoft
Very hard Kay and I never saw it posted before. no.gif Its a dll call btw.
Tsunami
Well, the first result on Google seems to work fine. You have to register to get it though, but that's done quickly.
maxXPsoft
Tsunami Guess you right if you looking to install another dll.
NOT for me.
Surely theres a way to make that dll call to the existing dll.
Then its a tweak
Oh_Kay
maxXPsoft : Nice to see your still a regular here, I don't get around these parts as much as I used to newwink.gif

Thanks for your input on this one, I didn't realise it was a dll call, I dunno nothing about dll's so I would never have thought to look down that road...

Tsunami: WOW ! I Googled till I could Google no more on that one, I can't imagine what you typed in to get that result, but a huge THANKS !!

From reading that link, the author of that code had the same problem I now have and had to resort to writing something to do the job, and while Im not nuts about adding something else to the system when I don't know what it does, I really want the functionality of this one... so until something better comes along, Im gonna run with it...

Seasons Greetings to one and all.

Kay
evilvoice
deleted
Yzöwl
Google search criteria was "find target" context
filthy_mcnasty
a buddy of mine recently asked me to write him a program to do this and the first step of doing so is researching exactly how it's done and i've come across an even more simple way than an entire program.......so i realize this post here is old news but maybe this will help someone out in the future.......

you can use a registry hack like this to add "Find Target" to the context menu for every single file type and directory....cant seem to get this to work for just shortcut (.lnk) files (there really is no point in "find target" if you're looking at the file right?) but hopefully this will point someone in the right direction.



Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\Find.Target]
@="&Find Target"

[HKEY_CLASSES_ROOT\Directory\shell\Find.Target\command]
@="\"explorer.exe\" /select,\"%1\""

[HKEY_CLASSES_ROOT\*\shell]

[HKEY_CLASSES_ROOT\*\shell\Find.Target]
@="&Find Target"

[HKEY_CLASSES_ROOT\*\shell\Find.Target\command]
@="\"explorer.exe\" /select,\"%1\""
maxXPsoft
filthy_mcnasty
Perhaps it don't work since .lnk is a normally hidden extension. I know theres a reg tweak to turn them into not hidden but it makes things look nasty lol
eidenk
Target Folder Opener

Link Open
TiredLion
Hello.

Oh_key, I'm afraid you won't find such a registry hack for .lnk files. As far as I know you need to load the shelllink and resolve it. After this you'll be able to find the target object. At least Context Magic doing so. I agree with maxXPsoft, you'll need a .dll.

Have a nice day,
Leonid
Oh_Kay
Wow, I started this thread 9 months ago, and here I am again, after a reinstall, looking for the method to add this back in to my windows all over again, it's the feature I just can't live without !!

Thanks to everyone for the replies, I have been using the first soloution from Code Project for months now and it works fine, so thats what I will be using again.

It would be nice if there was an easeir way to implement it rather than adding a DLL file, but thats up to Microsoft to add this feature in to their next OS (hint hint)

smile.gif

Kay
MHz
CODE
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\Find.Target]
@="&Find Target"

[HKEY_CLASSES_ROOT\Directory\shell\Find.Target\command]
@="\"explorer.exe\" /select,\"%1\""

[HKEY_CLASSES_ROOT\*\shell]

[HKEY_CLASSES_ROOT\*\shell\Find.Target]
@="&Find Target"

[HKEY_CLASSES_ROOT\*\shell\Find.Target\command]
@="\"explorer.exe\" /select,\"%1\""


The long wait is over. Enjoy. newwink.gif
evilvoice
hmmm, doesnt work for me...in using it from cmd window, this is just used to select the file in a explorer window
Yzöwl
You could always use 'target' from Windows 95 Power Toys, (it still works on XP).

It should be available from JSI,Inc - tip 8336
MHz
QUOTE (evilvoice @ Sep 19 2005, 03:27 PM)
hmmm, doesnt work for me...in using it from cmd window, this is just used to select the file in a explorer window
*

Driving a car from the back seat is unworkable also. Half-hearted attempts mean little. I do not call the command interpreter from the registry to run it. huh.gif
Find Target opens explorer to select the file that the shortcut points to. So what is the difference between the RegTweak and the one in shortcut tab in properties?
It does require displaying to only *.lnk files which the RegTweak needs to be improved upon.
evilvoice
QUOTE (MHz @ Sep 19 2005, 05:37 AM)
QUOTE (evilvoice @ Sep 19 2005, 03:27 PM)
hmmm, doesnt work for me...in using it from cmd window, this is just used to select the file in a explorer window
*

Driving a car from the back seat is unworkable also. Half-hearted attempts mean little. I do not call the command interpreter from the registry to run it. huh.gif
Find Target opens explorer to select the file that the shortcut points to. So what is the difference between the RegTweak and the one in shortcut tab in properties?
It does require displaying to only *.lnk files which the RegTweak needs to be improved upon.
*




the added portion of the command window was an extra attempt on my part to see if it worked...I really wish it did, but it does not...using the find target in props works fine...just this reg tweak does not. I copied your code directly into a reg entry, merged it, right click on a lnk file, selected find target and it takes me to where the lnk file is (which is All Users Desktop), whereas find target in props takes me to C:\ and highlights the folder.
Yzöwl
Here's an alternative, instead of using explorer to go to a folder containing the target, it just pops up a message box.
    First create this file and save it as %SystemRoot%\system32\GeTarget.vbs
CODE
MsgBox CreateObject("WScript.Shell").CreateShortcut(WScript.Arguments (0)).TargetPath
The above should all be on one line.
    Now paste this into Start » Run and click OK
CODE
REG ADD "HKCU\Software\Classes\lnkfile\Shell\Find Target\command" /ve /d "wscript.exe \"%SystemRoot%\system32\GeTarget.vbs\" \"%1\"" /f
This should be all one line also.

Now right click any shortcut and choose Find Target
praveenkumar_ht
Take a look at this file,just run it

code used from filthy_mcnasty's Post


thumbup.gif find target

it worked for me, i'm using winxp with SP2 welcome.gif welcome.gif welcome.gif
Yzöwl
@ praveenkumar_ht

The Microsoft file I linked to at JSI, works, as does my vbs method above your reply, as also does this, also c/o JSI.

Incidentally MHZ's code is identical to that already given by filthy_mcnasty
clavicle
I have got this file findtarget.dll which I downloaded from some very good coding site, (I don't remember which).
I use the ua cd to register it in my sytem32 folder using
regsvr32.exe /s "%WINDIR%\SYSTEM32\FINDTARGET.DLL"

It gives me what you all are looking for, working in Winxp Pro.

If you need it, I am not sure if I can post it, I will send it (small size 6.36kb)
Yzöwl
@ clavicle

The dll file is probably the one in use already the original questioner, Oh_Kay.

However the Microsoft PowerToys file I linked to is also a dll file.

The only problem with both of these examples is that we would prefer not to use a dll file.

Not that there is anything wrong in you offering your file, just that it seems that the thread is re-covering old ground again, with little new being added.
clavicle
@Yzöwl
Curosity kills the cat! I didn't go into details, may be the file is same, in fact I wanted to end the hunt by offering a tested solution. Thanks!
dubbin
Hi all,

I stumbled on this thread (and forum!) from google, and this is my first post, but I just wanted to report that I have combined the suggestions of MHz and Yzöwl into the following:

CODE
Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Classes\lnkfile\Shell\Find Target\command]
@="\"explorer.exe\" /select,\"%1\""


(save as plain text with the extension .REG, and run it)

This seems to work for me in XP, with no need for additional DLLs. Thanks to everyone in the thread for the ingredients!
eidenk
QUOTE (Yzöwl @ Sep 19 2005, 08:28 AM) *
@ clavicle

The dll file is probably the one in use already the original questioner, Oh_Kay.

However the Microsoft PowerToys file I linked to is also a dll file.

The only problem with both of these examples is that we would prefer not to use a dll file.

Not that there is anything wrong in you offering your file, just that it seems that the thread is re-covering old ground again, with little new being added.

Indeed

QUOTE (eidenk @ Aug 16 2005, 06:16 AM) *


Of course they are both in Japanese but you just have to tweak the context menu entry to put it in english.
maxXPsoft
@dubbin
Nice,
but not quite, if its a link on the desktop then it simply open's desktop and shows the Target which points nowhere intended
kaya
QUOTE
Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Classes\lnkfile\Shell\Find Target\command]@="\"explorer.exe\" /select,\"%1\""


When you click on a shortcut in "Quick Launch", it opens Quick Launch folder, not the shortcut's target folder.
Yzöwl
As nobody has picked up on it yet, from my vbs alternative earlier, here is a working method!
First create this file and save it as %SystemRoot%\system32\GeTarget.vbs
CODE
Wscript.Echo CreateObject("WScript.Shell").CreateShortcut(WScript.Arguments (0)).TargetPath
The above should all be on one line.
Now paste this single line into Start » Run and click OK
CODE
reg add "HKCU\Software\Classes\lnkfile\Shell\Find Target\command" /ve /d "%comspec% /c @echo off&for /f \"delims=\" %%? in ('cscript //nologo %SystemRoot%\system32\GeTarget.vbs \"%1\"') do start \"\" explorer.exe /select, \"%%~?\"" /f
Now right click any shortcut and choose Find Target

I hope this is better!
maxXPsoft
QUOTE (Yzöwl @ Nov 4 2005, 07:04 AM) *
As nobody has picked up on it yet, from my vbs alternative earlier, here is a working method!
I hope this is better!

Don't work here, I see a cmd flash and nothing
Yzöwl
I have it running flawlessly on my machines.

What is the string in your registry value data?
This is mine
C:\WINDOWS\system32\cmd.exe /c @echo off&for /f "delims=" %%? in ('cscript //nologo C:\WINDOWS\system32\GeTarget.vbs "%1"') do start "" explorer.exe /select, "%%~?"
maxXPsoft
C:\WINDOWS\system32\cmd.exe /c @echo off&for /f "delims=" %? in ('cscript //nologo C:\WINDOWS\system32\GeTarget.vbs ""') do start "" explorer.exe /select, "%~?"

I see it now from yours and wonder how that happen, I'm missing the double %% in two places. I copied your stuff and pasted in a cmd file instead of run. The double %% is in the cmd file. Strange

Wanted it in a cmd file for my Unattends
Works when I set it like yours manually. Maybe I better export that reg instead of cmd
Ed999
The solution to this problem is probably to go to START > RUN and type:

regsvr32 /i shell32.dll
danp129
Here's a script I made for this.

CODE
'Filename: FindTarget.vbs
'Description: Simulates 'Find Target' button in shortcut properties dialog.
'Created by: Danp129
'@yahoo.com
'Usage: Double click FindTarget.vbs and click 'Yes' to register file.
' Right click a shortcut and click 'Find Target'

' If previous 'Find Target' context menu exists it can backup old
' setting to backup.txt in same path this file is executed from.

option explicit
Dim objShell, sAppPath, ret, sNewRegVal
Const ForAppending = 8

Set objShell = CreateObject("WScript.Shell")

sNewRegVal = "cscript /nologo """ & Wscript.ScriptFullName & """ ""%1"""
sAppPath = Mid(Wscript.ScriptFullName, 1, InStrRev(Wscript.ScriptFullName, "\") - 1)

if WScript.Arguments.count > 0 then
'Script was called from context menu

call FindTarget
else
'Script was not sent arguments, was likely double clicked on
if sNewRegVal<>GetCurRegVal or isnull(GetCurRegVal) then
'Ask user if they wish to add Find Target context menu
ret=msgbox("Register this file as your 'Find Target' handler?", vbYesNo, "Add 'Find Target' context menu?")
if ret=vbYes then
'Call sub to create context menu using this file to handle requests
call CreateContextMenu
end if
else
msgbox "This file is already registered to handle 'Find Target' context menu." & vbcrlf & _
vbcrlf & "To use, simply right-click a shortcut and click 'Find Target'.", vbOKOnly, "Incorrect use"
end if
end if

Set objShell = nothing


Sub FindTarget()
Dim sMainFile, sCmd, sArgs, sPath, arArgOverride, sArgOverride, i, fso, arTmp, sTmp

'Specify lower-case exe files to check if an argument exists
' and should attempt to browse to the argument if it's a
' valid path instead of executable
'Use pipe "|" to seperate files
' e.g. ("notepad.exe|anotherapp.exe")
arArgOverride=split("notepad.exe")

'Shell command for explorer.exe
sCmd = "explorer.exe /select,"

'Main file the link refers to e.g. notepad.exe in 'c:\windows\notepad.exe c:\file.txt'
sMainFile=lcase(CreateObject("WScript.Shell").CreateShortcut(WScript.Arguments(0)).TargetPath)

'Additional arguments in link e.g. c:\file.txt in 'notepad.exe c:\arg.txt'
sArgs=CreateObject("WScript.Shell").CreateShortcut(WScript.Arguments(0)).Arguments

'Check to see if we should browse to arg if specified, if so set blnUseArg to true
if sArgs <> "" then

'get filename only
arTmp=split(smainfile, "\")
sTmp=arTmp(ubound(arTmp))

'Search override filenames for a match
for i = 0 to ubound(arArgOverride)
if sTmp=arArgOverride(i) then
'Create FSO object
Set fso = CreateObject("Scripting.FileSystemObject")

'Remove quotes and leading spaces from args or fso.FileExists will fail
sArgs=trim(replace(sArgs, """", ""))

'See if args is a valid path
if fso.FileExists(sArgs) or fso.FolderExists(sArgs) then
'Use args for path
sPath=sArgs
end if
exit for
end if
next 'iArgO

'Use main file if args was not a valid path
if sPath="" then sPath=sMainFile
else
'No arguments in the shortcut.. Use main file for path
sPath=sMainFile
end if

'Have Explorer open folder containing path
objShell.Run sCmd & sPath

set fso=nothing
end sub

sub CreateContextMenu()

Dim sRegKey, fso, sBackupFile, oTextFile
sBackupFile=sAppPath & "\" & "backup.txt"

sRegKey = GetCurRegVal
if not isnull(sRegKey) then
'Add some prompts to backup current value
if sRegKey<>sNewRegVal and sRegKey<>"" then
ret=msgbox("'Find Target' context menu already exists, would you like to backup the current setting before making changes?", vbYesNoCancel, "Backup current settings?")
if ret=vbCancel then exit sub
if ret=vbYes then
'Save current value to text file, append if backup already exists.
Set fso = CreateObject("Scripting.FileSystemObject")
set oTextFile = fso.OpenTextFile(sBackupFile, ForAppending, true)

oTextFile.Writeline sRegKey
oTextFile.Close
set fso=nothing
set oTextFile=nothing
end if
end if
end if

'Write to registry
objShell.RegWrite "HKCU\Software\Classes\lnkfile\Shell\Find Target\command\", sNewRegVal, "REG_SZ"
end sub

function GetCurRegVal
on error resume next
GetCurRegVal=objShell.RegRead("HKCU\Software\Classes\lnkfile\Shell\Find Target\command\")
if err.number <> 0 then
GetCurRegVal=null
end if
on error goto 0
end function
Yzöwl
Looks like a good idea, I'm not in a position to try it at present however.

Nice first post by the way.
maxXPsoft
I've found the 100% cure with a simple reg tweak constructed exactly like it needs to be with no dll.
I'll not disclose it now since its part of my new tweaking program soon to release.

If Oh_Kay still interested then msg me so you can beta the tweak
maxXPsoft
Windows Registry Editor Version 5.00
;Note for the Find Target to work you need a default Open unknown files.
;This adds Open w/Notepad if you don't already have something set. Comment out if you do.

[HKEY_CLASSES_ROOT\*\shell\open]
@="Open w/Notepad"

[HKEY_CLASSES_ROOT\*\shell\open\command]
@="notepad.exe \"%1\""

[HKEY_CLASSES_ROOT\*\shell\Find Target\command]
@="explorer.exe /select, \"%1\""

Included with 2.3.1 of MaxsTweakR for XP/Vista
Vista has 'Open file location' on its right click.
Google Internet Forums Unattended CD/DVD Guide
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.