Behavior of CD command for C: v.s C:\

English support forum

Moderators: white, Hacker, petermad, Stefan2

User avatar
petermad
Power Member
Power Member
Posts: 14808
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Behavior of CD command for C: v.s C:\

Post by *petermad »

Moderator message from: petermad » 2024-01-30, 14:13 UTC


2JOUBE
It's about practice: and D: is better in this case as D:\
That depends - cd D:\ will always take you the the root of D:, but cd D: will take you to whatever directory that is currently active on drive D:
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Fla$her
Power Member
Power Member
Posts: 2318
Joined: 2020-01-18, 04:03 UTC

Re: [Tc11] Suggestion: COMMANDER_INI_PATH

Post by *Fla$her »

ghisler(Author) wrote: 2024-01-24, 07:52 UTC But returning D: instead of D:\ would also be wrong!
You haven't explained why. I asked you, you didn't answer:
Fla$her wrote: 2024-01-19, 20:35 UTC
ghisler(Author) wrote: 2024-01-19, 07:58 UTC you can't use a backslash consistently when it's possible that the location is a drive root
And why can't? %COMMANDER_DRIVE% doesn't return "\". We can use %COMMANDER_DRIVE%\blabla. It's the same here.

petermad wrote: 2024-01-24, 13:23 UTC but cd D: will take you to whatever directory that is currently active on drive D:
I don't see anything like that. I checked this before I wrote the previous message. The path always changes to the drive root.
Overquoting is evil! 👎
Fla$her
Power Member
Power Member
Posts: 2318
Joined: 2020-01-18, 04:03 UTC

Re: [Tc11] Suggestion: COMMANDER_INI_PATH

Post by *Fla$her »

Fla$her wrote: 2024-01-24, 13:59 UTC The path always changes to the drive root.
There is one nuance. In my build, cd is an alias, where the command is cd and the parameter is %Z%A.
I don't understand how this can affect the execution if the essence is the same. :shock:
Without this alias cd %COMMANDER_DRIVE% refuses to work. Only cd %COMMANDER_DRIVE%\ works.
cd d:\ => does not work.
This is strange. It works for me.
Overquoting is evil! 👎
User avatar
AntonyD
Power Member
Power Member
Posts: 1249
Joined: 2006-11-04, 15:30 UTC
Location: Russian Federation

Re: [Tc11] Suggestion: COMMANDER_INI_PATH

Post by *AntonyD »

It works for me.
outdated WinXP?
win10 (2 different builds) and Win11 - all the same.
And that's very logical: CD [/D] [диск:][путь]
this is a quote from Windows help system for this command.
As you can see here is literally mentioned only Disk Letter and symbol :
#146217 personal license
Fla$her
Power Member
Power Member
Posts: 2318
Joined: 2020-01-18, 04:03 UTC

Re: [Tc11] Suggestion: COMMANDER_INI_PATH

Post by *Fla$her »

AntonyD wrote: 2024-01-24, 15:41 UTC
It works for me.
outdated WinXP?
What's the difference? This behavior should not be related to the Windows version in any way.
It's the same on Win 7. Which version do you think petermad wrote about?
Compare x32 vs x64 better.
AntonyD wrote: 2024-01-24, 15:41 UTC And that's very logical: CD [/D] [диск:][путь]
this is a quote from Windows help system for this command.
As you can see here is literally mentioned only Disk Letter and symbol :
TC is not obliged to coordinate its behavior with the specifics of an ancient and non-developing program cmd.exe.
But in any case, such problems should be eliminated from TC everywhere.
Overquoting is evil! 👎
User avatar
AntonyD
Power Member
Power Member
Posts: 1249
Joined: 2006-11-04, 15:30 UTC
Location: Russian Federation

Re: [Tc11] Suggestion: COMMANDER_INI_PATH

Post by *AntonyD »

I don't understand what Total has to do with it at all, when it comes to commands that are characteristic ONLY for cmd.exe or its modern counterparts: windows terminal, power shell ...
As for me, the execution of this command, even if we write it in the Total cmd.line, should be processed in cmd.exe, and ITS result (bad or good) should be reflected in the Total panels. Otherwise, we get some kind of willfulness now. Total suddenly has ITS own vision of HOW to execute this command. But this is fundamentally wrong. It should work exactly as it would in the windows shell. And how it happens - I have specially shown above.
#146217 personal license
User avatar
Dalai
Power Member
Power Member
Posts: 9393
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: [Tc11] Suggestion: COMMANDER_INI_PATH

Post by *Dalai »

2AntonyD

Code: Select all

cd /D D:\
will work. The cd command requires this switch if it's supposed to change directory to another drive.

But in TC the command

Code: Select all

cd D:\
works fine.
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
petermad
Power Member
Power Member
Posts: 14808
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: [Tc11] Suggestion: COMMANDER_INI_PATH

Post by *petermad »

Fla$her wrote: 2024-01-24, 13:59 UTC
petermad wrote: 2024-01-24, 13:23 UTC but cd D: will take you to whatever directory that is currently active on drive D:
I don't see anything like that. I checked this before I wrote the previous message. The path always changes to the drive root.
Try this:
1. Make a button with cd D: in the command field (change D: if you don't have a drive D:)

2. In the left side of TC go to C:\ and in the right panel go into a subdir on drive D: for example D:\test
3. Activate TC's left panel (the one with C.\)
4. Click the button - TC opens D:\test and not D:\

This is the same way it works in a DOS box: https://tcmd.madsenworld.dk/cdtest.png

After step 2 her above you can even change the drive in the right side, the result is still the same - it is not about what dir is shown in the right side, it is about what dir the system registers as last activated for drive D:, and TC always sets the dir in the panel to be the last opened to the system.
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Fla$her
Power Member
Power Member
Posts: 2318
Joined: 2020-01-18, 04:03 UTC

Re: [Tc11] Suggestion: COMMANDER_INI_PATH

Post by *Fla$her »

AntonyD wrote: 2024-01-24, 16:19 UTC As for me, the execution of this command, even if we write it in the Total cmd.line, should be processed in cmd.exe
:lol: Are you serious? There is and cannot be any direct connection between TC and any console program, even system, even external.
cd in TC performs many other functions besides changing the directory locally: going to a file, opening an archive, going to subfolders in an archive, going to an ftp path, network path, opening system plugin paths, filtering files in panels by mask or template, including hiding folders. What does cmd have to do with it?

2petermad
You missed part of the discussion again.
Overquoting is evil! 👎
User avatar
petermad
Power Member
Power Member
Posts: 14808
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: [Tc11] Suggestion: COMMANDER_INI_PATH

Post by *petermad »

Fla$her wrote: 2024-01-24, 17:03 UTC
2petermad
You missed part of the discussion again.
You quote something I wrote ( https://ghisler.ch/board/viewtopic.php?p=448598#p448598 ) before the part you refer to ( part of the discussion ) , so how can I have missed anything? And spare me for the condescending "again".
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Fla$her
Power Member
Power Member
Posts: 2318
Joined: 2020-01-18, 04:03 UTC

Re: [Tc11] Suggestion: COMMANDER_INI_PATH

Post by *Fla$her »

petermad wrote: 2024-01-24, 17:13 UTC You quote something I wrote ( https://ghisler.ch/board/viewtopic.php?p=448598#p448598 ) before the part you refer to ( part of the discussion ) , so how can I have missed anything? And spare me for the condescending "again".
I didn't understand what you mean. In the new message, you tried to discuss something that is no longer relevant, given my clarifications about the alias.
You missed this part of the discussion. Therefore, given the recent case, I'm writing "again". I write as I see fit. I don't see any point in sulking over nothing.
Overquoting is evil! 👎
User avatar
petermad
Power Member
Power Member
Posts: 14808
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: [Tc11] Suggestion: COMMANDER_INI_PATH

Post by *petermad »

2Fla$her
What I wrote is still relevant. Even if make a cd alias, what I write here: https://ghisler.ch/board/viewtopic.php?p=448619#p448619 still applies when using the command line instead of a button.

I assume that you use an intermediate em_command for your cd alias - like this

Code: Select all

[em_cd]
cmd=CD
param=%Z%A
- otherwise I cannot see how to make a cd alias:

Code: Select all

[Alias]
cd=em_cd

Also:
Fla$her wrote:Without this alias cd %COMMANDER_DRIVE% refuses to work. Only cd %COMMANDER_DRIVE%\ works.
Here by me it is the opposite: cd %COMMANDER_DRIVE% and cd %COMMANDER_DRIVE%\ from command line only works without the alias - Alias implemented as I describe here above - but maybe your implementation of the alias is different?
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Fla$her
Power Member
Power Member
Posts: 2318
Joined: 2020-01-18, 04:03 UTC

Re: [Tc11] Suggestion: COMMANDER_INI_PATH

Post by *Fla$her »

2petermad
The alias is correct, but something tells me that the reason was different (maybe some options affect it), I'll look later.
Overquoting is evil! 👎
Fla$her
Power Member
Power Member
Posts: 2318
Joined: 2020-01-18, 04:03 UTC

Re: [Tc11] Suggestion: COMMANDER_INI_PATH

Post by *Fla$her »

2petermad
Fla$her wrote: 2024-01-24, 20:10 UTC 2petermad
... maybe some options affect it ...

Code: Select all

[Configuration]
AlwaysToRoot=1
Configuration > Operation > ☑ Always go to the root of a drive when changing drives

2ghisler(Author)
Is the difference between cd X: and cd X:\ with AlwaysToRoot=0 and X:\blabla in the target path a feature or a bug?
Overquoting is evil! 👎
User avatar
petermad
Power Member
Power Member
Posts: 14808
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: [Tc11] Suggestion: COMMANDER_INI_PATH

Post by *petermad »

Fla$her wrote: 2024-01-30, 01:05 UTC Is the difference between cd X: and cd X:\ with AlwaysToRoot=0 and X:\blabla in the target path a feature or a bug?
I would say neither - it is the behavior of the system - cd /D X: in a command prompt also goes to the current directory of X: not necessarily to the root - so I think it is pertinent that TC does the same, when not configured to always go to root.
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Post Reply