1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

cd shell:sendto

Discussion in 'Suggestions' started by w_krieger, Nov 7, 2009.

  1. w_krieger

    Joined:
    Nov 2, 2008
    Messages:
    170
    Likes Received:
    0
    Something i would like to see is to be able to change to directories like 'sendto' or 'program files' by way of cd shell:sendto or something.

    Typing shell:sendto will open the correct folder in explorer.
     
  2. drrob106

    Joined:
    Jan 24, 2009
    Messages:
    36
    Likes Received:
    0
    I am running WinXP SP2 and v11.

    You can do what you wish in your alias file.
    I have this line in my tcstart.bat
    alias/r aliasdef.txt

    And in aliasdef.txt I have this line
    docs:=%userprofile\My Documents\

    This lets me copy files to My Documents by
    copy * docs:

    and I can
    cd docs:
    or
    cdd docs:

    You can define whatever you like to be
    sendto:progfiles:
    You get the point.

    Good Luck
    --rob

    On Sat, 2009-11-07 at 01:36 -0600, w_krieger wrote:

     
  3. samintz

    samintz Scott Mintz

    Joined:
    May 20, 2008
    Messages:
    1,178
    Likes Received:
    11
    You could do something similar to that using directory aliases.

    for example:

    alias sendto:="%HOMEDRIVE%%HOMEPATH\SendTo"

    You can also use the @SHFOLDER function and assign that to a directory
    alias.

    alias sendto:=%@SHFOLDER[9]

    -Scott




    w_krieger <>
    11/07/2009 02:36 AM
    Please respond to



    To
    Samintz@ra.rockwell.com
    cc

    Subject
    [Suggestions-t-1560] cd shell:sendto






    Something i would like to see is to be able to change to directories like
    'sendto' or 'program files' by way of cd shell:sendto or something.

    Typing shell:sendto will open the correct folder in explorer.
     
  4. w_krieger

    Joined:
    Nov 2, 2008
    Messages:
    170
    Likes Received:
    0
    Unfortunately using something like %userprofile%\ etc does not work, because these are in different directories according to the windows version.

    You could do it by the means i do it:

    cdd %_regquery["HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Sendto"]%

    I mean is it possible to shorten this to something like

    cdd %_shfolder[Sendto]%

    where _shfolder would search HKCU and HKLM (in that order) for the relevant folder?
     
  5. dcantor

    Joined:
    May 29, 2008
    Messages:
    505
    Likes Received:
    3
    Here's a VERY minimally tested prototype function:
    Code:
    @echo off
    rem File C:\work\shellfolder.btm
    rem Dave Cantor, 13 Nov 2009
    
    set targdir=%1
    set x=-1
    if not defined targdir goto done
    
    do regkey in /L HKCU HKLM
      set x=%@regquery["%regkey%\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\%targdir"]
      if "%x" ne "-1" leave
     enddo
    
    :done
    echo %x
    quit
    
    Save this as (e.g.) c:\work\shellfolder.btm
    Define a function as
    Code:
    function shellfolder=`%@execstr[c:\work\shellfolder.btm %$]`
    
    and use it as
    Code:
    echo %@shellfolder[sendto]
    
    It will return -1 if there is no such folder defined or if one was not specified. If there is a definition for the requested folder, the name is returned, but it might not exist. You can a check for existence if you want.
     
  6. samintz

    samintz Scott Mintz

    Joined:
    May 20, 2008
    Messages:
    1,178
    Likes Received:
    11
    TCC already has this function built-in. See @SHFOLDER[].

    -Scott


    w_krieger <> wrote on 11/13/2009 02:30:51 AM:


    version.

     
  7. dcantor

    Joined:
    May 29, 2008
    Messages:
    505
    Likes Received:
    3
    Yes, but the original poster is looking for a way of specifying the name of the folder, not a number.
     
  8. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,277
    Likes Received:
    38
    Code:
    alias sendto:=%@shfolder[9]\
    works for me.
     
  9. dcantor

    Joined:
    May 29, 2008
    Messages:
    505
    Likes Received:
    3
    Well, sure, but I interpreted the original poster's request as using sendto as an example. I suspect he wants to be able to find Desktop, Fonts, and the other special folders as well. My response was for the general case, but not quite complete, of course.

    In my .btm that I posted, replace the single occurrence of "%1" with "%$" without quotation marks.
     
  10. samintz

    samintz Scott Mintz

    Joined:
    May 20, 2008
    Messages:
    1,178
    Likes Received:
    11
    While having text makes the script easier to read and using the @shfolder
    function at the command line requires knowing magic numbers, I would
    suspect that most people that use that function use it with directory
    aliases or buried within a batch file. That means you look up the number
    you want in the help file, program it, and then forget about it.

    The folders are named different things in different languages. So using a
    number makes it work across all languages.

    if %APPDATA or sendto is a folder I go to often, then it's easier to
    define a directory alias and use that instead of remembering/typing all
    the subtlies.

    -Scott

    dcantor <> wrote on 11/13/2009 07:24:34 PM:


    sendto

     
  11. w_krieger

    Joined:
    Nov 2, 2008
    Messages:
    170
    Likes Received:
    0
    You could set a function like this eset /f shfolder line:

    shfolder=%@regquery["HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\%1"]

    It gives under Windows XP: ("google hivefix.inf for the trick!")

    [Q:\save\mswin\EXE]echo %@shfolder[sendto]
    Q:\USERS\Wendy\SendTo
     
  12. It's actually

    cdd %@regquery["HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\SendTo"]
    ----- Original Message -----
    From: w_krieger
    To: CSGalloway@nc.rr.com
    Sent: Friday, November 13, 2009 02:31 AM
    Subject: RE: [Suggestions-t-1560] Re: cd shell:sendto


    Unfortunately using something like %userprofile%\ etc does not work, because these are in different directories according to the windows version.

    You could do it by the means i do it:

    cdd %_regquery["HKCU\Software\Microsoft\Windows\CurrentVersion\Exp lorer\Shell Folders\Sendto"]%

    I mean is it possible to shorten this to something like

    cdd %_shfolder[Sendto]%

    where _shfolder would search HKCU and HKLM (in that order) for the relevant folder?
     
  13. w_krieger

    Joined:
    Nov 2, 2008
    Messages:
    170
    Likes Received:
    0
    I posted strings from a working command prompt, so i suppose HKCU works too.

    In any case, the shfolder[sendto] expands to the expression ye give, save for HKCU for hkey-current-user.
     

Share This Page