cd shell:sendto

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
Nov 2, 2008
177
0
#1
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.
 
Jan 24, 2009
36
0
#2
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
May 20, 2008
1,203
11
Solon, OH, USA
#3
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.
 
Nov 2, 2008
177
0
#4
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?
 
May 29, 2008
516
3
Groton, CT
#5
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
May 20, 2008
1,203
11
Solon, OH, USA
#6
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?
>
>
 
May 29, 2008
516
3
Groton, CT
#9
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
May 20, 2008
1,203
11
Solon, OH, USA
#10
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.
>
>
 
Nov 2, 2008
177
0
#11
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
#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?
 
Nov 2, 2008
177
0
#13
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.