Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account



Photo

Open shorcut linked folder - Context Menu

- - - - -

  • Please log in to reply
4 replies to this topic

#1
Dogway

Dogway

    Advanced Member

  • Member
  • PipPipPip
  • 394 posts
  • Joined 24-December 11
  • OS:XP Pro x86
  • Country: Country Flag
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 solutions
findtarget.reg
opentargetdir.vbs

and a script I took on a random forum:

@echo off
If exist %windir%\FT.vbs (
echo Uninstall?&echo.&pause
reg delete HKCR\lnkfile\shell\FT /f
del %windir%\FT.vbs
exit
)
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 0
dim ws,objArgs,strPath
Set objArgs = WScript.Arguments
if objArgs.Count>0 then
           strPath=mid(objArgs(0),instr(objArgs(0),"/")+1,len(objArgs(0))-instr(objArgs(0),"/"))
end if
set 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 = Nothing
End Function

The 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, etc

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


How to remove advertisement from MSFN

#2
Yzöwl

Yzöwl

    Wise Owl

  • Super Moderator
  • 4,574 posts
  • Joined 13-October 04
  • OS:Windows 7 x64
  • Country: Country Flag

Donator

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

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

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


#3
Dogway

Dogway

    Advanced Member

  • Member
  • PipPipPip
  • 394 posts
  • Joined 24-December 11
  • OS:XP Pro x86
  • Country: Country Flag
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

#4
submix8c

submix8c

    Inconceivable!

  • Patrons
  • 4,407 posts
  • Joined 14-September 05
  • OS:none specified
  • Country: Country Flag
For the record (the "random forum") you may want to try this just for funsies -
http://www.freewareg...-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.

HTH

edit - tacking on another - from link above, the poster "tireless" agreed that the script was not so hot and also linked to (guess where?)...
http://www.msfn.org/...ge__pid__728230
and a notation

Open 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.goo...W22M1IWUvK5kMg#

This one points back to Yzowl script -
http://translate.goo...7s0llGIXm-L3pzg
;)

Edited by submix8c, 30 January 2013 - 04:04 PM.

Someday the tyrants will be unthroned... Jason "Jay" Chasteen; RIP, bro!

Posted Image


#5
Dogway

Dogway

    Advanced Member

  • Member
  • PipPipPip
  • 394 posts
  • Joined 24-December 11
  • OS:XP Pro x86
  • Country: Country Flag
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).




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users