Dogway Posted January 30, 2013 Share Posted January 30, 2013 How can I add a Find Target entry to context menu for shortcut files only? So when I click it takes me directly to the linked folder (and not file).I tried several solutionsfindtarget.regopentargetdir.vbsand a script I took on a random forum:@echo offIf exist %windir%\FT.vbs (echo Uninstall?&echo.&pausereg delete HKCR\lnkfile\shell\FT /fdel %windir%\FT.vbsexit)reg add "HKCR\lnkfile\shell\FT" /f /ve /t REG_SZ /d "&Find Target..."reg add "HKCR\lnkfile\shell\FT\command" /f /ve /t REG_SZ /d "WScript.exe %windir%\FT.vbs \"%%1\""more +10 < %0 >%windir%\FT.vbs && exit /b 0dim ws,objArgs,strPathSet objArgs = WScript.Argumentsif objArgs.Count>0 then strPath=mid(objArgs(0),instr(objArgs(0),"/")+1,len(objArgs(0))-instr(objArgs(0),"/"))end ifset ws=CreateObject("Wscript.Shell")ws.run "Explorer /select, " & GetTargetPath(strPath)Function GetTargetPath(LinkName) On Error Resume Next Dim Shortcut Set Shortcut = CreateObject("Wscript.Shell").CreateShortcut(LinkName) GetTargetPath = Shortcut.TargetPath Shortcut.Save Set Shortcut = NothingEnd FunctionThe problem is that none of them work for all shorcuts and eventually they only take me to a temporal folder where the icon is placed, etcFor example, it doesn't work with the live msn shortcut, and for the nero 10 shortcut it takes me to C:\WINDOWS\Installer\{7A5D731D-B4B3-490E-B339-75685712BAAB} Link to comment Share on other sites More sharing options...
Yzöwl Posted January 30, 2013 Share Posted January 30, 2013 This is how I recall having done this task in the past. I have no idea if it is the same or any better than your example method, but feel free to give it a shot.First create this file and save it as %SystemRoot%\system32\GeTarget.vbsWscript.Echo CreateObject("WScript.Shell").CreateShortcut(WScript.Arguments (0)).TargetPathThe above should all be on one line.Now paste this single line into Start » Run and click OKreg 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 Link to comment Share on other sites More sharing options...
Dogway Posted January 30, 2013 Author Share Posted January 30, 2013 Thanks, it is the exact same as my posted script. It only works in the same shortcuts and if anything a bit slower (passing through console window).For example, it doesn't work in my desktop Chrome icon, MSN... the nero shortcut takes me to the same place, etc Link to comment Share on other sites More sharing options...
submix8c Posted January 30, 2013 Share Posted January 30, 2013 (edited) For the record (the "random forum") you may want to try this just for funsies -http://www.freewaregenius.com/open-target-shell-extension-find-target-folders-for-shortcuts-through-the-context-menu-in-xp-op/Seems that the chap "tireless" is (maybe) the one that "invented" the script (read through above link to ANOTHER solution). There are exactly four references to that BAT file, one being OSZONES forum (was that the random one?).Just check out the link given for potential solution.HTHedit - tacking on another - from link above, the poster "tireless" agreed that the script was not so hot and also linked to (guess where?)...and a notationOpen Target may be nice, but doesn’t work on XP x64 (is a 32 bit shell extension).edit - Also for the record, not all Shortcuts are created equal, e.g. Right-Click on the IE Desktop ICON or even My Computer, My Documents, Network Places and select Properties. The Targets work entirely differently from the Standard Shortcuts. I believe that Class-ID's have something to do with some of them.OSZONES Forum - To get that code you have above just "View Source" and look for it.http://translate.googleusercontent.com/translate_c?depth=1&hl=en&ie=UTF8&prev=_t&rurl=translate.google.com&sl=ru&tl=en&u=http://forum.oszone.net/thread-82654-3.html&usg=ALkJrhhLUsstjH1PkKaYW22M1IWUvK5kMg#This one points back to Yzowl script -http://translate.googleusercontent.com/translate_c?depth=1&hl=en&ie=UTF8&prev=_t&rurl=translate.google.com&sl=ru&tl=en&u=http://forum.oszone.net/showthread.php%3Fs%3D0814105185aa107d3d2f5369f04074f2%26t%3D57552&usg=ALkJrhh4517-MfU9HT27s0llGIXm-L3pzg Edited January 30, 2013 by submix8c Link to comment Share on other sites More sharing options...
Dogway Posted January 30, 2013 Author Share Posted January 30, 2013 That is not the web where I took the script from, it was more like a forum, and there were corrections over the script. AFAIK there are not many different methods, so I named the three I know, included the one you linked to me in the msfn page. It's the exact same behaviour I described above (did you test it? no right? there you go). Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now