How to? Is there a way to see current directories in all drives?

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
May 20, 2009
218
0
53
ITALY
#1
If I type "cd" or "cdd", without parameters, it shows the path of the current directory in the current drive. For example, in C: drive I am in "C:\abc". In D: drive I am in "D:\xyz". If I am in C: drive, I would like to be able to know that if I type "D:" I will end in "D:\xyz". Is it possible, maybe without changing drive? Or I have to ask for the wish list in a future release?

Thank You very much and regards

Rodolfo Giovanninetti
 
#2
You can use the @CWD Function, e.g.
Code:
(system)  C:\...\TCCLE13x64 >d:
 
(data1)  D:\ >cd io
 
(data1)  D:\IO >C:\Program Files\JPSoft\TCCLE13x64\
 
(system)  C:\...\TCCLE13x64 >for %d in ( %_drives ) if %@ready[%d] eq 1 if %@removable[%d] ne 1 echo %@cwd[%d]
 
C:\Program Files\JPSoft\TCCLE13x64
D:\IO
E:\
F:\
 
#3
Slightly simpler to use %_ready:

alias allcwd=`for %d in (%_ready) echo %d %@cwd[%d]`

Tested! Report includes all currently accessible drives, local and mapped network drives, including USB sticks, CD/DVD, etc.
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
3,483
44
Albuquerque, NM
prospero.unm.edu
#4
If I type "cd" or "cdd", without parameters, it shows the path of the current directory in the current drive. For example, in C: drive I am in "C:\abc". In D: drive I am in "D:\xyz". If I am in C: drive, I would like to be able to know that if I type "D:" I will end in "D:\xyz". Is it possible, maybe without changing drive? Or I have to ask for the wish list in a future release?
What happens if you type CDD /A ?
 
#5
What happens if you type CDD /A ?
Code:
(system)  C:\...\TCCLE13x64 >cdd /a
C:\Program Files\JPSoft\TCCLE13x64
D:\IO
E:\
F:\
every day at least one new lesson learned :)

%_ready : I know this one but it doesn't work in LE and it shows me CD/DVD what I don't want.
 

rconn

Administrator
Staff member
May 14, 2008
10,292
90
#8
I wanted to clarify one thing about this topic -- in Windows, you do not have a current directory on any other drive! There is a single "current directory", and it's the one you're in.

What TCC (and CMD) do is fudge this a bit (originally to provide some backwards compatibility to DOS batch files). TCC will create (and update) a hidden environment variable that contains the CWD for the current drive. When you switch to another drive, TCC will create a hidden variable containing the CWD for that drive. HOWEVER (it's a big however!) Windows neither knows nor cares about these variables, so when you run another app, it will start over with a single current directory. (There are a few apps that will look for the hidden environment variables, but you certainly can't count on it.)
 
#9
I wanted to clarify one thing about this topic -- in Windows, you do not have a current directory on any other drive! There is a single "current directory", and it's the one you're in.

What TCC (and CMD) do is fudge this a bit (originally to provide some backwards compatibility to DOS batch files). TCC will create (and update) a hidden environment variable that contains the CWD for the current drive. When you switch to another drive, TCC will create a hidden variable containing the CWD for that drive. HOWEVER (it's a big however!) Windows neither knows nor cares about these variables, so when you run another app, it will start over with a single current directory. (There are a few apps that will look for the hidden environment variables, but you certainly can't count on it.)
Don't modern versions of Windows still keep track of the hidden environment variables like "=C:".
 
#11
Slightly simpler to use %_ready:

alias allcwd=`for %d in (%_ready) echo %d %@cwd[%d]`

Tested! Report includes all currently accessible drives, local and mapped network drives, including USB sticks, CD/DVD, etc.
I prefer my (slightly different) version:

Code:
for %A in (%_ready) do echo %@format[-12,%@label[%A]] %@cwds[%A]
I've mentioned before in another thread I have a "colorful" version of this as well.
 
#12
I wanted to clarify one thing about this topic -- in Windows, you do not have a current directory on any other drive! There is a single "current directory", and it's the one you're in.
I don't understand. In TCC you can do this:

Code:
[D:\Y\Y]ver /R

TCC  13.03.47   Windows XP [Version 5.1.2600]
TCC Build 47   Windows XP Build 2600  Service Pack 3
Registered to Miguel Farah
 
[D:\Y\Y]cdd /A
C:\TEMP\XX
D:\Y\Y
F:\
M:\fotos_de_Alberto\20090813
N:\

[D:\Y\Y]copy M:IMG_0002.JPG C:
M:\fotos_de_Alberto\20090813\IMG_0002.JPG => C:\TEMP\XX\IMG_0002.JPG
     1 archivo copiado

[D:\Y\Y]
While in CMD.EXE you can do the same:

Code:
Microsoft Windows XP [Versión 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\Miguel>cd \TEMP\XX

C:\TEMP\XX>M:

M:\>cd fotos_de_Alberto\20090813

M:\fotos_de_Alberto\20090813>D:

D:\>cd Y\Y

D:\Y\Y>copy M:IMG_0003.JPG C:
        1 archivos copiados.

D:\Y\Y>dir C:
 El volumen de la unidad C es ARMENGOL.160
 El número de serie del volumen es: B024-7079

 Directorio de C:\TEMP\XX

10/04/2012  21:20    <DIR>          .
10/04/2012  21:20    <DIR>          ..
13/08/2009  16:26           111.872 IMG_0002.JPG
13/08/2009  16:26            93.696 IMG_0003.JPG
               2 archivos        205.568 bytes
               2 dirs  92.089.872.384 bytes libres

D:\Y\Y>
Which means both TCC and CMD handle a "current directory" for each drive. Or are we talking about something similiar, but not exactly the same?