MSFN Forum: Open shorcut linked folder - Context Menu - MSFN Forum

Jump to content


Unattended CD/DVD Guide Homepage · MSFN Forum Rules

If you have questions about customizing Windows XP that are nLite-specific, please post them in the nLite forum, not here. If you have questions regarding the unattended installation of Windows XP, please post them in the Unattended Windows 2000/XP/2003 section.
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Open shorcut linked folder - Context Menu Rate Topic: -----

#1 User is offline   Dogway 

  • Member
  • PipPip
  • Group: Members
  • Posts: 194
  • Joined: 24-December 11
  • OS:XP Pro x86
  • Country: Country Flag

Posted 30 January 2013 - 09:30 AM

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}


#2 User is offline   Yzöwl 

  • Wise Owl
  • Group: Super Moderator
  • Posts: 4,363
  • Joined: 13-October 04
  • OS:Windows 7 x64

Posted 30 January 2013 - 12:10 PM

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 User is offline   Dogway 

  • Member
  • PipPip
  • Group: Members
  • Posts: 194
  • Joined: 24-December 11
  • OS:XP Pro x86
  • Country: Country Flag

Posted 30 January 2013 - 12:56 PM

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 User is offline   submix8c 

  • Inconceivable!
  • Group: Patrons
  • Posts: 3,241
  • Joined: 14-September 05
  • OS:none specified
  • Country: Country Flag

Posted 30 January 2013 - 01:11 PM

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

Quote

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

This post has been edited by submix8c: 30 January 2013 - 04:04 PM


#5 User is offline   Dogway 

  • Member
  • PipPip
  • Group: Members
  • Posts: 194
  • Joined: 24-December 11
  • OS:XP Pro x86
  • Country: Country Flag

Posted 30 January 2013 - 01:47 PM

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

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

2 User(s) are reading this topic
0 members, 2 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2013 msfn.org
Privacy Policy