Can you add a cm command to restart TC?
Moderators: Hacker, petermad, Stefan2, white
Re: Can you add a cm command to restart TC?
2monarch-lfv
I remember. Have you not read my answer to this yet?
P. S.: In vain you wedged in. I'm afraid the author won't see my request.
I remember. Have you not read my answer to this yet?
P. S.: In vain you wedged in. I'm afraid the author won't see my request.
Overquoting is evil! 👎
Re: Can you add a cm command to restart TC?
Mr. Ghisler, I love this new addition! Could there also be a parameter 8 that switches between admin-elevated and non-elevated mode? Is that easy to do? I know there are workarounds to do it, but it seems like it fits so nice right here!ghisler(Author) wrote: 2022-10-04, 16:22 UTC Total Commander 10.52 RC1 is available now! CM_EXIT now supports the following parameters:
0 or no parameter: Just exit.
Or sum of:
1: Exit and restart Total Commander
2: Exit and restart, and switch between 32-bit and 64-bit versions (note: 2 and 3 do the same thing)
4: Save directories, tabs and panels (brief, full etc.) even when disabled in settings
EDIT: Maybe I spoke to soon about there being a workaround. Are there actually workarounds to do restart elevated? I'm having trouble using the %COMMANDER_PATH% and %COMMANDER_INI% to launch the second window elevated because they don't exist in the elevated session. Hmmm.... has anyone done this without hard-coding the path names?
- ghisler(Author)
- Site Admin
- Posts: 50459
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Re: Can you add a cm command to restart TC?
In RC2, parameter 8 does something else now:
8: Pass current left and right directory and file under cursor to new instance
I have considered the elevated option, but the switch from elevated to non-elevated is a hack and mess. You can define an em_command to run TC elevated, by putting a * at the beginning of the command line.
8: Pass current left and right directory and file under cursor to new instance
I have considered the elevated option, but the switch from elevated to non-elevated is a hack and mess. You can define an em_command to run TC elevated, by putting a * at the beginning of the command line.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
Re: Can you add a cm command to restart TC?
sirksel wrote: 2022-10-11, 04:22 UTC
Mr. Ghisler, I love this new addition! Could there also be a parameter 8 that switches between admin-elevated and non-elevated mode? Is that easy to do? I know there are workarounds to do it, but it seems like it fits so nice right here!
EDIT: Maybe I spoke to soon about there being a workaround. Are there actually workarounds to do restart elevated? I'm having trouble using the %COMMANDER_PATH% and %COMMANDER_INI% to launch the second window elevated because they don't exist in the elevated session. Hmmm.... has anyone done this without hard-coding the path names?
%COMMANDER_PATH% and such env vars are only available inside of TC and programs started from TC.
You can use this copy&paste button-code
Code: Select all
TOTALCMD#BAR#DATA
*"%COMMANDER_EXE%"
%Z/N %X"%P" "%T"
%COMMANDER_EXE%
Launch 2nd TC instance e.g. as ADMIN
0
-1
but due to the leading * , you will be prompted
so you could change user or enter admin credentials or just launch TC as is as second instance.
Re: Can you add a cm command to restart TC?
How about allowing one direction by allowing *cm_Exit to restart elevated?ghisler(Author) wrote: 2022-10-11, 06:52 UTC I have considered the elevated option, but the switch from elevated to non-elevated is a hack and mess. You can define an em_command to run TC elevated, by putting a * at the beginning of the command line.
Re: Can you add a cm command to restart TC?
I like that ideaHow about allowing one direction by allowing *cm_Exit to restart elevated?

License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Re: Can you add a cm command to restart TC?
Stefan2 wrote: 2022-10-11, 07:08 UTC You can use this copy&paste button-codeCode: Select all
TOTALCMD#BAR#DATA *"%COMMANDER_EXE%" %Z/N %X"%P" "%T" %COMMANDER_EXE% Launch 2nd TC instance e.g. as ADMIN 0 -1
I prefer this modification:
Code: Select all
TOTALCMD#BAR#DATA
*%COMMANDER_EXE% /N /P /A /i="%COMMANDER_INI%"
%Z%X %P%N* %T%M*
%COMMANDER_EXE%
Launch 2nd TC instance e.g. as ADMIN
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Re: Can you add a cm command to restart TC?
@stefan2 and @petermad, thanks for the button code!
Mr. Ghisler, I agree with @white that even just one way (non-elevated to elevated) would be fantastic. I can get this to work with the workaround, but I seem to be losing all my custom menus and stuff when I make a custom command and map it to a keystroke (that is not a toolbar button). I think it has to do with the environment variables not yet existing in the new session. I'm experimenting with the button code the others volunteered to see if I can get the workaround to work.
Mr. Ghisler, I agree with @white that even just one way (non-elevated to elevated) would be fantastic. I can get this to work with the workaround, but I seem to be losing all my custom menus and stuff when I make a custom command and map it to a keystroke (that is not a toolbar button). I think it has to do with the environment variables not yet existing in the new session. I'm experimenting with the button code the others volunteered to see if I can get the workaround to work.
Re: Can you add a cm command to restart TC?
2sirksel
The "%COMMANDER_INI%" variable in the button command IS recognized.
Does that mean that you are starting your TC from a batch file where you set environment variables?I think it has to do with the environment variables not yet existing in the new session
The "%COMMANDER_INI%" variable in the button command IS recognized.
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Re: Can you add a cm command to restart TC?
2petermad
Thanks for the help. If it works in a button, does that mean it should also work in a em_command that is assigned in a custom menu or [shortcuts]? All my setup is around keystrokes rather than buttons, but I thought what would work in a button would work in a custom command definition. I'll mess with it a bit more to see what's going on, when I get home from work tonight.
(I have a custom ftp.ini so I have to use some relative path references since there isn't, at least to my knowledge, a %COMMANDER_FTP% environment var. Maybe when I remove some of those complications when I get home from work tonight, it will work for me as a custom command.) Thanks again.
Thanks for the help. If it works in a button, does that mean it should also work in a em_command that is assigned in a custom menu or [shortcuts]? All my setup is around keystrokes rather than buttons, but I thought what would work in a button would work in a custom command definition. I'll mess with it a bit more to see what's going on, when I get home from work tonight.
(I have a custom ftp.ini so I have to use some relative path references since there isn't, at least to my knowledge, a %COMMANDER_FTP% environment var. Maybe when I remove some of those complications when I get home from work tonight, it will work for me as a custom command.) Thanks again.
Re: Can you add a cm command to restart TC?
YesIf it works in a button, does that mean it should also work in a em_command that is assigned in a custom menu or [shortcuts]?
Code: Select all
TOTALCMD#BAR#DATA
*%COMMANDER_EXE% /N /P /A /i="%COMMANDER_INI%"
%Z%X %P%N* %T%M*
%COMMANDER_EXE%
Launch 2nd TC instance e.g. as ADMIN
Code: Select all
[em_openTCasAdmin]
cmd=*%COMMANDER_EXE% /N /P /A /i="%COMMANDER_INI%"
param=%Z%X %P%N* %T%M*
button=%COMMANDER_EXE%
menu=Launch 2nd TC instance e.g. as ADMIN
Use: "%COMMANDER_INI%\..\my_ftp.ini"(I have a custom ftp.ini so I have to use some relative path references since there isn't, at least to my knowledge, a %COMMANDER_FTP% environment var. Maybe when I remove some of those complications when I get home from work tonight, it will work for me as a custom command.) Thanks again.
for example:
Code: Select all
[em_openTCasAdmin]
cmd=*%COMMANDER_EXE% /N /P /A /i="%COMMANDER_INI%" /f="%COMMANDER_INI%\..\my_ftp.ini"
param=%Z%X %P%N* %T%M*
button=%COMMANDER_EXE%
menu=Launch 2nd TC instance e.g. as ADMIN
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Re: Can you add a cm command to restart TC?
white wrote:How about allowing one direction by allowing *cm_Exit to restart elevated?
Confirmed working in TC 10.52rc3 - so what more can we wish for...?history.txt wrote:14.10.22 Added: CM_EXIT: Add 16 to parameter to restart with full administrator rights (elevated) (32/64)
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Re: Can you add a cm command to restart TC?
Should I repeat my requests? Or will you find it yourself?

Overquoting is evil! 👎
Re: Can you add a cm command to restart TC?
2petermad
Thanks so much for all the help. I didn't have the button parameters exactly lined up correctly with the custom command parameters. Your detailed parallel of the two approaches allowed me to see that clearly. On the ftp.ini issue, that relative directory resolution worked great for me. Thank you.
2ghisler
I guess your excellent new changes made it all easier anyhow. I got back from a weekend away and found another pleasant surprise from Mr. Ghisler! Thanks so much for putting that in. Works great in 10.52rc3!
Thanks so much for all the help. I didn't have the button parameters exactly lined up correctly with the custom command parameters. Your detailed parallel of the two approaches allowed me to see that clearly. On the ftp.ini issue, that relative directory resolution worked great for me. Thank you.
2ghisler
I guess your excellent new changes made it all easier anyhow. I got back from a weekend away and found another pleasant surprise from Mr. Ghisler! Thanks so much for putting that in. Works great in 10.52rc3!