# Donecd shell:sendto

#### w_krieger

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.

#### drrob106

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:

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

#### samintz

##### Scott Mintz
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

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.

#### w_krieger

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?

#### dcantor

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

#### samintz

##### Scott Mintz
TCC already has this function built-in. See @SHFOLDER[].

-Scott

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

> 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?
>
>

#### dcantor

TCC already has this function built-in. See @SHFOLDER[].
Yes, but the original poster is looking for a way of specifying the name of the folder, not a number.

#### Charles Dye

##### Super Moderator
Yes, but the original poster is looking for a way of specifying the name of the folder, not a number.
Code:
``alias sendto:=%@shfolder[9]\``
works for me.

#### dcantor

Code:
``alias sendto:=%@shfolder[9]\``
works for me.
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.

#### samintz

##### Scott Mintz
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:

> Quote:
>
> Originally Posted by Charles Dye [image removed]
> Code:
> alias sendto:=%@shfolder[9]\
> works for me.
>
> 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.
>
>

#### w_krieger

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

C

#### CSGalloway@nc.rr.com

##### Guest
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?

#### w_krieger

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.