Page 5 of 5
Re: Can you add a cm command to restart TC?
Posted: 2022-10-17, 11:49 UTC
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?
Is that documented somewhere? I clearly need to re-read that page as I may be missing other important features.
Many thanks!
Re: Can you add a cm command to restart TC?
Posted: 2022-10-17, 11:54 UTC
by petermad
2
sirksel
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.
Re: Can you add a cm command to restart TC?
Posted: 2022-10-17, 11:59 UTC
by sirksel
I like it! I never would have figured that one out on my own. Many thanks.
Re: Can you add a cm command to restart TC?
Posted: 2022-10-17, 12:06 UTC
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?
Re: Can you add a cm command to restart TC?
Posted: 2022-10-17, 12:36 UTC
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.
Re: Can you add a cm command to restart TC?
Posted: 2022-10-18, 05:50 UTC
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
Re: Can you add a cm command to restart TC?
Posted: 2022-10-20, 04:52 UTC
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?
Re: Can you add a cm command to restart TC?
Posted: 2022-10-20, 08:09 UTC
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.
Re: Can you add a cm command to restart TC?
Posted: 2022-10-20, 23:53 UTC
by sirksel
Autorun is perfect for my use case. Thank you.
Re: Can you add a cm command to restart TC?
Posted: 2022-10-28, 08:30 UTC
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.
2
ghisler(Author)
Would you, please, be so kind to consider implementing such an option (saving columns width) upon exit/restart too?
Thank you.
Re: Can you add a cm command to restart TC?
Posted: 2022-10-28, 14:13 UTC
by petermad
2
beb
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.
Re: Can you add a cm command to restart TC?
Posted: 2022-10-29, 01:31 UTC
by beb
2petermad
Oh, thank you!