Alias for cd <path> doesn't work in button bar

The behaviour described in the bug report is either by design, or would be far too complex/time-consuming to be changed

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
DrShark
Power Member
Power Member
Posts: 1872
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262
Contact:

Alias for cd <path> doesn't work in button bar

Post by *DrShark »

To reproduce:
1. Make some alias for cd <path> command, e.g. by writing following to wincmd.ini:
[Alias]
cd %userprofile%\Desktop\=cm_OpenDesktop

Save wincmd.ini, restart TC.

2. Add following button to button bar:

Code: Select all

TOTALCMD#BAR#DATA
cd %userprofile%\Desktop\

imageres.dll,104
Desktop


-1
3. Execute from TC's command line:
cd %userprofile%\Desktop\

As expected, you'll be redirected by alias to virtual desktop folder.

4. Execute button created in step 2:
redirection by alias doesn't happen, so TC goes to file system %userprofile%\Desktop\ folder.
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Post by *petermad »

As far as I know:
1: Aliases is not supported in the Command field for buttons
2: Aliases can only be used on the command line.
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.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
DrShark
Power Member
Power Member
Posts: 1872
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262
Contact:

Post by *DrShark »

petermad wrote:As far as I know:
1: Aliases is not supported in the Command field for buttons
2: Aliases can only be used on the command line.
Help's example says alias should work in a button:
Help -> Dialog box: Configuration - Change button bar wrote:Example: Alias op points to Command: totalcmd.exe Parameter: /L=%A1 /R=%A2
-> Command line: op c:\dir1 d:\dir2 will create command: totalcmd.exe /L=c:\dir1 /R=d:\dir2
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Post by *petermad »

Example: Alias op points to Command: totalcmd.exe Parameter: /L=%A1 /R=%A2
-> Command line: op c:\dir1 d:\dir2 will create command: totalcmd.exe /L=c:\dir1 /R=d:\dir2
It is meant for making an em_command (cm_CommandBrowser -> usercmd.ini -> New or Edit -> Help) - The "Change button bar" and the "Choose Command -> Change single button" shares the same help page.

So if you make an em_command like this in yout usercmd.ini:

Code: Select all

[em_tc]
button=%COMMANDER_EXE%,6
cmd=%COMMANDER_EXE%
param=/L=%A1 /R=%A2
And you have an alias like this:

Code: Select all

[Alias]
op=em_tc
Then on the command line you can type:

Code: Select all

op c:\dir1 d:\dir2
and a new instance of TC will open with these two dirs.
____________

But a button like this will not work:

Code: Select all

TOTALCMD#BAR#DATA
op

%COMMANDER_EXE%,6



-1
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.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
DrShark
Power Member
Power Member
Posts: 1872
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262
Contact:

Post by *DrShark »

If it's true that aliases intentionally don't work anywhere except TC's Command line, then I suggest to describe it on Help pages:
* Dialog box: Configuration - Change button bar
* Dialog box: Configuration - Misc.
And for example with "op" alias in Help, I suggest to add a requirement to create a user command to make it work in command line, like in example from petermad's above post.
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
User avatar
DrShark
Power Member
Power Member
Posts: 1872
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262
Contact:

Post by *DrShark »

OK, this topic moved to "Behaviour which will not be changed" subforum.
Which means aliases work only in command line.
Why not make it more clear in a help? E.g. on Dialog box: Configuration - Misc. page, change the text from
Enter an alias here, e.g. "np" to start Notepad via the command line.
to something like
Enter an alias here, e.g. "np" to start Notepad via the command line (aliases work only in command line, not Button Bar.)
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Well, it already says "via the command line".
Author of Total Commander
https://www.ghisler.com
User avatar
DrShark
Power Member
Power Member
Posts: 1872
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262
Contact:

Post by *DrShark »

ghisler(Author) wrote:Well, it already says "via the command line".
I just think "via the command line (not Button bar)" would be more clear, at least for me - I wouldn't create this topic then.
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
Post Reply