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

May 20, 2009
293
5
57
ITALY
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
 
Aug 2, 2011
258
4
Berlin, Germany
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:\
 
May 20, 2008
3,515
4
Elkridge, MD, USA
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
4,497
91
Albuquerque, NM
prospero.unm.edu
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 ?
 
Aug 2, 2011
258
4
Berlin, Germany
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.
 
Aug 2, 2011
258
4
Berlin, Germany
you're right.
 

rconn

Administrator
Staff member
May 14, 2008
12,406
152
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.)
 
May 20, 2008
11,547
107
Syracuse, NY, USA
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:".
 
Nov 2, 2009
295
6
Chile
www.farah.cl
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.
 
Nov 2, 2009
295
6
Chile
www.farah.cl
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?
 
Similar threads
Thread starter Title Forum Replies Date
Joe Caverly How to? Get name of current LIBRARY function? Support 4
R How to? Open Take Command at current folder Support 7
R CMDebug, dark theme, current line Support 7
R How to? Obtain current colors Support 2
K copy changing destination current directory Support 1
A Installer /extract: extracts into current directory if target not exists Support 12
scottb How to? ipconfig output in current window Support 4
vefatica TCMD's current directory? Support 4
vefatica Update to current install dir? Support 8
Allen TCC 17 Beta - current functionality? Support 5
M Hotkey-mechanism, for doing something with the current command-line Support 4
S DESKTOP - identify current active ? Support 4
Charles Dye IFTP, current directory, open new connection Support 0
A How to? Copy current directory to clipboard Support 9
M How to? A very simple question re. the current line number in a batch file... Support 2
daniel347x How to get Take Command to read in all current system environment variables that CMD.EXE sees? Support 13
D Extracting the current command line, extracting current path Support 4
J Utility to Save/Restore current screen Support 16
gworley Virtual network drive filename completion doesn’t get directories Support 0
thorntonpg sync /S /F creating empty directories Support 5
WadeHatler pdir broken in 19.1 for directories with spaces Support 1
P Color directories in Win10 build 10586 console Support 11
R How to? Name completion only of directories? Support 3
fromano How to? Everything finding directories with 2 or more files in them Support 3
M Problem with Extended Search and non-ASCII characters in directories names Support 3
M . and .. directories counted by @files function Support 5
J rmdir /s recurses into symlinkd directories Support 4
D ffind and directories Support 2
S Listing the paths of all directories of a given name Support 4
thedave Newly created directories missing from TCMD Support 0
S GPF after successfully renaming directories on an ftp server Support 2
nikbackm Sorting (DIR) over sub-directories Support 3
p.f.moore Compare 2 directories Support 8
S DEL unhides directories Support 9
D _USBS list misses flash drives that @USB recognizes. Support 7
R Everything service locking thumb drives Support 1
R Fixed Using %~dp1 for paths with unavailable drives Support 6
P VMWare Shared Drives Support 3
J TCC10 and mapped drives Support 4
R Don't wake up external drives on startup Support 2

Similar threads