Allow combine an internal command and "cd directory" for a button

Here you can propose new features, make suggestions etc.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
Slavic
Senior Member
Senior Member
Posts: 290
Joined: 2006-02-26, 15:41 UTC
Location: Montenegro

Allow combine an internal command and "cd directory" for a button

Post by *Slavic »

The feature I would like to request isn't well documented, so if I misunderstood something, my apologies.

This problem occurs when you attempt to use some commands in a sequence for a toolbar button. Apparently, the internal commands can be input with comma divider without limitation, but not all commands with parameters. Let's look at very simple case: we need to select the right TC panel and change its directory to c:\windows. We can call the button dialog and input two these commands in a row with comma divider. But unfortunately, the command line

cm_FocusRight,cd c:\Windows\

doesn't work. It shows an error "File not found! (below is our command line) The system cannot find the file specified." Adding quotes to path or to whole cd... command, as it usually needs for Windows paths, doesn't help. Apparently current TC logic doesn't permit using the cd command in a sequence and, when "cd" is detected, TC attempts to use the whole command line as an argument.

Can this problem be resolved and logic improved?
Desktop: Windows 11 Pro 23H2, TC 11.03(RC). Mobile: Pixel 5a, Android 14, TC 3.42b5
User avatar
Dalai
Power Member
Power Member
Posts: 9386
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: Allow combine an internal command and "cd directory" for a button

Post by *Dalai »

I'm aware this is a suggestion. Just a note in case you don't know this: Currently there's only one way to work around this. The cm_ command with the parameter must be moved to a user-defined em_ command. Then the resulting commands can be used in sequence.

Example:
cm_FocusRight,em_cdWindows

where em_cdWindows is a user-defined command that makes use of the regular cd C:\Windows command. User-defined commands can be added in TC's command browser (cm_CommandBrowser) in usercmd.ini section.

Regards
Dalai
#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
ghisler(Author)
Site Admin
Site Admin
Posts: 48075
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Allow combine an internal command and "cd directory" for a button

Post by *ghisler(Author) »

While the above example would work, the reversed one would be unclear:
cd c:\Windows\,cm_FocusRight
because a directory named ",cm_FocusRight" can actually exist! So it's not clear whether the user wants to go to
c:\Windows\,cm_FocusRight
or to
c:\Windows\
and then execute the command cm_FocusRight.
Author of Total Commander
https://www.ghisler.com
User avatar
Stefan2
Power Member
Power Member
Posts: 4153
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: Allow combine an internal command and "cd directory" for a button

Post by *Stefan2 »

ghisler(Author) wrote: 2020-09-07, 09:52 UTC ...
because a directory named ",cm_FocusRight" can actually exist!
...
Right.

There might be 0,1% possibility that a folder named ",cm_FocusRight" exists,
but there are 99,9% of frustrated users because they can't use the command as simple as it could be.

I would rather ignore the liberty of the 0,1%-users.

Maybe implement a feature to explicitly separate commands:
cd c:\Windows\?,cm_FocusRight



 
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Re: Allow combine an internal command and "cd directory" for a button

Post by *MVV »

The problem is that cd is not the only possible command, some users may want to execute other commands with parameters too, so is not easy to find a good separator. Your "?," looks very confusing, I would prefer to require quotes around path for cd command instead so it would be clear where path ends, but it will work only for cd command:

Code: Select all

cd "c:\windows",cm_FocusRight
Slavic
Senior Member
Senior Member
Posts: 290
Joined: 2006-02-26, 15:41 UTC
Location: Montenegro

Re: Allow combine an internal command and "cd directory" for a button

Post by *Slavic »

Exactly.
It would be very reasonable to use the quotes if the command cd directory (and other similar commands which include path or filename) is not alone but used in a sequence. Even if quotes in a particular case are not required for Windows command processor, they may be mandatory here:

cm_FocusRight,cd "c:\Windows\"
Desktop: Windows 11 Pro 23H2, TC 11.03(RC). Mobile: Pixel 5a, Android 14, TC 3.42b5
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Re: Allow combine an internal command and "cd directory" for a button

Post by *MVV »

The only problem is that this won't allow using other commands with arbitrary parameters where quotes may be in the middle.
Post Reply