Can you add a cm command to restart TC?

Here you can propose new features, make suggestions etc.

Moderators: white, Hacker, petermad, Stefan2

sirksel
Junior Member
Junior Member
Posts: 61
Joined: 2013-04-24, 10:24 UTC

Re: Can you add a cm command to restart TC?

Post by *sirksel »

One more quick question re petermad's suggestion, but probably others could answer it too... I probably just missed it in the help file, but what do the asterisks (*) do here?

Code: Select all

param=%Z%X %P%N* %T%M*
Is that documented somewhere? I clearly need to re-read that page as I may be missing other important features.
Many thanks!
User avatar
petermad
Power Member
Power Member
Posts: 14795
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Can you add a cm command to restart TC?

Post by *petermad »

2sirksel
but what do the asterisks (*) do here?
It is to make it work correctly when the cursor is placed on ".." in the top of the file panel or when in the root - see: viewtopic.php?p=412884#p412884

But with TC 10.52rc3 you can now use cm_Exit 9 - it does the same (as when you use em_newcommander together with cm_Exit), but better.
Last edited by petermad on 2022-10-17, 12:03 UTC, edited 1 time in total.
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
sirksel
Junior Member
Junior Member
Posts: 61
Joined: 2013-04-24, 10:24 UTC

Re: Can you add a cm command to restart TC?

Post by *sirksel »

I like it! I never would have figured that one out on my own. Many thanks.
sirksel
Junior Member
Junior Member
Posts: 61
Joined: 2013-04-24, 10:24 UTC

Re: Can you add a cm command to restart TC?

Post by *sirksel »

2petermad

And if you want to restart TC as admin like with all the directories as before, it would be cm_Exit 25, right?

How about if you want to do exactly this, but simply as a new window, without exiting your current instance? Do you have to use the %COMMANDER_EXE% method you outlined earlier, or is there a combo of the cm_Exit options that does that?
User avatar
petermad
Power Member
Power Member
Posts: 14795
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Can you add a cm command to restart TC?

Post by *petermad »

And if you want to restart TC as admin like with all the directories as before, it would be cm_Exit 25, right?
Yes.
How about if you want to do exactly this, but simply as a new window, without exiting your current instance? Do you have to use the %COMMANDER_EXE% method you outlined earlier, or is there a combo of the cm_Exit options that does that?
You will have to use the *%COMMANDER_EXE% method.
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
User avatar
nsp
Power Member
Power Member
Posts: 1804
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Re: Can you add a cm command to restart TC?

Post by *nsp »

sirksel wrote: 2022-10-17, 12:06 UTCHow about if you want to do exactly this, but simply as a new window, without exiting your current instance? Do you have to use the %COMMANDER_EXE% method you outlined earlier, or is there a combo of the cm_Exit options that does that?
re-start is exit + start. In your case, you just want to start another instance.
As suggested by Peter, the best way is to use an em_startElevated that starts *%commander_exe% I personally like to have another ini for elevated totalcmd (as i want to have different colors and other wfx plugins) what i need most of the time is just to have same active tabs (%P %T).
This is a sample:

Code: Select all

*%commander_exe%
/N /P  %Z %X  %P%N %T%%M /i=wincmd_adv.ini /M=2
sirksel
Junior Member
Junior Member
Posts: 61
Joined: 2013-04-24, 10:24 UTC

Re: Can you add a cm command to restart TC?

Post by *sirksel »

Thank you both for these. I used commands for both options, so I can see which I use more!

Slightly off topic, but related to %commander_exe%... How do you all handle portable environment vars that you want available in the new instance (or in any instance for that matter). For example, I have a var for the location of my portableapps directory, among other things. I want these always to be available automatically whenever TC is running, since I use them in various custom commands run by TC.

Right now, to launch TC, I basically just launch an AHK script that's sets those environment vars and then launches TC. Is that the best way to do it, or do you all use a more elegant approach?
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6481
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: Can you add a cm command to restart TC?

Post by *Horst.Epp »

sirksel wrote: 2022-10-20, 04:52 UTC Thank you both for these. I used commands for both options, so I can see which I use more!

Slightly off topic, but related to %commander_exe%... How do you all handle portable environment vars that you want available in the new instance (or in any instance for that matter). For example, I have a var for the location of my portableapps directory, among other things. I want these always to be available automatically whenever TC is running, since I use them in various custom commands run by TC.

Right now, to launch TC, I basically just launch an AHK script that's sets those environment vars and then launches TC. Is that the best way to do it, or do you all use a more elegant approach?
The Autorun plugin can set Environment variables on startup of TC.
From its readme

SetEnv [/A] [/EV] [/EE] <var name> <var text>
Sets environment variable for current process.
Optional parameters:
[/A] - appends a text to exising variable text (replacing instead).
[/AD] - the same as /A, but allow duplicating (look note)
[/EV] - enbables using environment variable in text.
[/EE] - enbables using escape characters in text.
Windows 11 Home x64 Version 23H2 (OS Build 22631.3447)
TC 11.03 x64 / x86
Everything 1.5.0.1372a (x64), Everything Toolbar 1.3.3, Listary Pro 6.3.0.73
QAP 11.6.3.2 x64
sirksel
Junior Member
Junior Member
Posts: 61
Joined: 2013-04-24, 10:24 UTC

Re: Can you add a cm command to restart TC?

Post by *sirksel »

Autorun is perfect for my use case. Thank you.
User avatar
beb
Senior Member
Senior Member
Posts: 434
Joined: 2009-09-20, 08:03 UTC
Location: Odesa, Ukraine

Re: Can you add a cm command to restart TC?

Post by *beb »

  • CM_EXIT supports the following parameters (sum of):
    0 or no parameter: Just exit
    1: Restart Total Commander
    2: Restart Total Commander but switch between 32-bit and 64-bit versions (if the other exists in the same directory)
    3: Note: 2 and 3 do the same thing
    4: Save paths, directories, tabs, panels (brief, full, etc.), and display modes on exit even when it's disabled in the configuration
    8: Pass the current left and right directories and file under the cursor to the new instance
    16: Restart with full administrator rights (elevated) (32/64)
Still, 4 that is intended to save... panels (brief, full, etc.) does not preserve columns width.

2ghisler(Author)

Would you, please, be so kind to consider implementing such an option (saving columns width) upon exit/restart too?

Thank you.
#278521 User License
Total Commander [always the latest version, including betas] x86/x64 on Win10 x64/Android 10
User avatar
petermad
Power Member
Power Member
Posts: 14795
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Can you add a cm command to restart TC?

Post by *petermad »

2beb
Would you, please, be so kind to consider implementing such an option (saving columns width) upon exit/restart too?
Saving the columns is done together with saving the window position with the command cm_ConfigSavePos - so you could use the combined command cm_ConfigSavePos,cm_Exit 4.
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
User avatar
beb
Senior Member
Senior Member
Posts: 434
Joined: 2009-09-20, 08:03 UTC
Location: Odesa, Ukraine

Re: Can you add a cm command to restart TC?

Post by *beb »

2petermad
Oh, thank you!
#278521 User License
Total Commander [always the latest version, including betas] x86/x64 on Win10 x64/Android 10
Post Reply