Custom toolbar on taskbar startup path problem


  1. Posts : 2
    Windows enterprise N 64
       #1

    Custom toolbar on taskbar startup path problem


    Hi there,

    I've got different source trees, and each tree has a Shortcut folder (of which I add the shortcut folder to the taskbar)

    From the custom toolbar I want to be able to execute the shortcuts (.lnk file to actual bat files somewhere else in my source tree).

    Now the problem is all these links are relative paths (so to give an example of one shortcut)

    TARGET: %windir%\system32\cmd.exe "/C start ..\UI\VIP.sln
    STARTIN: %CD%

    now this works wonderful if you double click the link from windows explorer, because the %cd% returns the actual shortcut folder. e.g c:\sandbox\peopleportaltrunk\People.tools.

    Now if you execute this shortcut link from a custom toolbar the %cd% returns c:\windows\system32 and that means there is no way to find the actual shortcut folder path.

    I've tried various different options to try and retrieve the actual shortcut path, but no luck.

    I don't want to use environment variables, as for each toolbar I need to configure environment variables. and that is not an option.

    I also had a look at the "wmic datafile where name='vip.sln.lnk' get path" option, and that also does not work as I need to specify the path, but I want to retrieve the path..

    It there a way to reset the %cd% to the actual shortcut path, and not the c:\windows\system32? or any other way of getting the shortcut path ??

    Regards
    Paul
      My Computer


  2. Posts : 934
    Windows 8.1 ; Windows 7 x86 (Dec2008-Jan2013)
       #2

    You might want to try
    Code:
    %~dp0
    %~dp0 returns path of a batch file (and is obtained from %0 which is batch file's name).
      My Computer


  3. Posts : 2
    Windows enterprise N 64
    Thread Starter
       #3

    this does not work with the shortcut files that is linked into the taskbar, but however, after I've replaced all the .lnk files with actual .bat files, and used %~dp0 within the bat file it all works. thanks for the advice.

    Unfortunately now all the icons looks the same... (icon of the bat file type) and don't have the actual file type icon of where it points. I guess I have to sacrifice something...
    I had shortcuts to websites / .exe files, visual studio solutions with each one with the correct icon, but now all has a .bat file extension at the back and the bat file icon.
      My Computer


  4. Posts : 934
    Windows 8.1 ; Windows 7 x86 (Dec2008-Jan2013)
       #4

    You do not have to sacrifice anything.

    Go to Shortcut properties and edit Target line:
    Code:
    %windir%\explorer.exe "C:\whatever\yourSCRIPT.bat"
    Adding the red part will make this shortcut pinnable to task bar. Similar to Option two Computer - Pin to Taskbar


    .
    Last edited by Neutron16; 15 Aug 2011 at 10:56.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 06:50.
Find Us