Can you add a cm command to restart TC?

Here you can propose new features, make suggestions etc.

Moderators: white, Hacker, petermad, Stefan2

ruizrzr1
Junior Member
Junior Member
Posts: 37
Joined: 2022-07-06, 06:39 UTC

Can you add a cm command to restart TC?

Post by *ruizrzr1 »

I usually use tcimg to restart TC, but sometimes it will not start after TC is closed.
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

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

Post by *petermad »

I have these commands in my usercmd.ini file:

Code: Select all

[em_newcommander]
cmd=%COMSPEC% /C
param=%Z%X start "" "%%COMMANDER_EXE%%" /N /P /A /i="%%COMMANDER_INI%%" %P%N* %T%M*
menu=Open new instance of Total Commander with current directories
button=%COMMANDER_EXE%
iconic=1

[em_restartcommander]
cmd=em_newcommander, cm_Exit
button=%COMMANDER_EXE%
menu=Restart Total Commander  with current directories
button=%COMMANDER_EXE%
then I can user either of the two em commands in Buttonbar, Keyboard shortcuts, Main Menu, Start Menu or Directory Hotlist
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
Sir_SiLvA
Power Member
Power Member
Posts: 3278
Joined: 2003-05-06, 11:46 UTC

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

Post by *Sir_SiLvA »

petermad wrote: 2022-09-07, 17:47 UTC then I can user either of the two em commands in Buttonbar, Keyboard shortcuts, Main Menu, Start Menu or Directory Hotlist
THANK you very much for this :!:
I have been using ReloadTC till now which never worked for tc64 but this is perfect.
(PS: is there anyway to make TC load usercmd.ini from a userdefined folder like %Commander_Path%\Inis ?)
Hoecker sie sind raus!
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

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

Post by *petermad »

(PS: is there anyway to make TC load usercmd.ini from a userdefined folder like %Commander_Path%\Inis ?
No - TC will load it from the same directory as the current wincmd.ini file (location can be seen via the Menu: "Help" -> "About Total Commander".

But if you start TC like this:

Code: Select all

drive:\path\totalcmd64.exe /i=drive:\path\inis\wincmd.ini /f=drive:\path\inis\wcx_ftp.ini
then all inis (wincmd.ini, wcx_ftp.ini, fsplugin.ini, lsplugin.ini, pkplugin.ini and contplug.ini plus some plugins-specific inis) will be used from drive:\path\inis\

Notice you cannot use %Commander_Path% until TC is started (unless you have added it to Windows' environment manually).

The location of plugin ini files can be controlled in the [ReplaceIniLocation] section of your wincmd.ini file
Help wrote:[ReplaceIniLocation] Set a different ini file location for specific plugins, via function *SetDefaultParams, parameter DefaultIniName, via line pluginfile.ext=c:\path\newinifile.ini or pluginfile.ext=c:\path\ - the plugin may ignore the name and just use the path.
pluginname.ext= New location of ini file sent to the plugin. The plugin name must be specified without path, and with extension as configured in wincmd.ini, e.g. sftpplug.wfx
Special values:
* send default value, but redirect to user profile if location not writable (default for packer, file system, and lister plugins)
- send default value, but do not redirect to user profile on fail (default for content plugins)
Example:

Code: Select all

[ReplaceIniLocation]
cloudplugin.wfx=%COMMANDER_PATH%\PLUGINS\wfx\cloudplugin\tccloud.ini
sftpplug.wfx=%COMMANDER_PATH%\PLUGINS\wfx\sftpplug\sftpplug.ini
CHMDir.wcx=%COMMANDER_PATH%\PLUGINS\wcx\CHMDir\CHMDir.ini
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
Sir_SiLvA
Power Member
Power Member
Posts: 3278
Joined: 2003-05-06, 11:46 UTC

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

Post by *Sir_SiLvA »

petermad wrote: 2022-09-08, 00:15 UTC
(PS: is there anyway to make TC load usercmd.ini from a userdefined folder like %Commander_Path%\Inis ?
No - TC will load it from the same directory as the current wincmd.ini file (location can be seen via the Menu: "Help" -> "About Total Commander".

Example:

Code: Select all

[ReplaceIniLocation]
cloudplugin.wfx=%COMMANDER_PATH%\PLUGINS\wfx\cloudplugin\tccloud.ini
sftpplug.wfx=%COMMANDER_PATH%\PLUGINS\wfx\sftpplug\sftpplug.ini
CHMDir.wcx=%COMMANDER_PATH%\PLUGINS\wcx\CHMDir\CHMDir.ini
Thanks again I somehow missed [ReplaceIniLocation] when I read the history file :-(.
Also I only have decThumbsDBViewer.wlx (old and only 32Bit) and tcwebdav.wfx (by Chris)
as "bad boys" who save their inis in the wrong folder :)

PS:
1) I guess CHMDir.wcx was just an example because mine has its ini in its own folder
2) In my wincmd.ini under [Configuration] I have the key ‹L$÷A=6029370 you wouldnt by any change know what that is?
Hoecker sie sind raus!
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

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

Post by *petermad »

2Sir_SiLvA
In my wincmd.ini under [Configuration] I have the key ‹L$÷A=6029370 you wouldnt by any change know what that is?
Sorry I have no idea - I doubt very much that it is TC that has put it there.
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
monarch-lfv
Junior Member
Junior Member
Posts: 73
Joined: 2022-06-16, 23:37 UTC

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

Post by *monarch-lfv »

2petermad
Thank You!
Great solution. And what about fast switching between TCх32 and TCх64?
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6450
Joined: 2003-02-06, 17:36 UTC
Location: Germany

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

Post by *Horst.Epp »

While in the x64 version I use this button to start an x32 instance.

Code: Select all

TOTALCMD#BAR#DATA
%COMMANDER_PATH%\TOTALCMD.EXE
%Z/N %X"%P" "%T"
%COMMANDER_PATH%\TOTALCMD.EXE
TC x86

0
-1
Windows 11 Home x64 Version 23H2 (OS Build 22631.3374)
TC 11.03 x64 / x86
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.2, Listary Pro 6.3.0.69
QAP 11.6.3.2 x64
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

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

Post by *petermad »

Horst.Epp wrote: 2022-10-02, 08:56 UTC While in the x64 version I use this button to start an x32 instance.

Code: Select all

TOTALCMD#BAR#DATA
%COMMANDER_PATH%\TOTALCMD.EXE
%Z/N %X"%P" "%T"
%COMMANDER_PATH%\TOTALCMD.EXE
TC x86

0
-1
May I suggest to modify this to:

Code: Select all

TOTALCMD#BAR#DATA
%COMMANDER_PATH%\TOTALCMD.EXE
%Z /N /P %X %P%N* %T%M*
%COMMANDER_PATH%\TOTALCMD.EXE
TC x86

0
-1
Then the cursor will be placed on the same files/folders as in the 64bit version
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
Horst.Epp
Power Member
Power Member
Posts: 6450
Joined: 2003-02-06, 17:36 UTC
Location: Germany

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

Post by *Horst.Epp »

Thanks petermad :D
Much better than my version.
You are still the best
Windows 11 Home x64 Version 23H2 (OS Build 22631.3374)
TC 11.03 x64 / x86
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.2, Listary Pro 6.3.0.69
QAP 11.6.3.2 x64
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

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

Post by *petermad »

:oops:
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
monarch-lfv
Junior Member
Junior Member
Posts: 73
Joined: 2022-06-16, 23:37 UTC

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

Post by *monarch-lfv »

2Horst.Epp, 2petermad
Thanks! But I mean, one button, which change version TC "round trip". If executed Totalcmd.exe then start Totalcmd64.exe, and if executed Totalcmd64.exe then start Totalcmd.exe (one button!).
There is such an implementation in the mentioned TCIMG.
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6450
Joined: 2003-02-06, 17:36 UTC
Location: Germany

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

Post by *Horst.Epp »

monarch-lfv wrote: 2022-10-02, 11:45 UTC 2Horst.Epp, 2petermad
Thanks! But I mean, one button, which change version TC "round trip". If executed Totalcmd.exe then start Totalcmd64.exe, and if executed Totalcmd64.exe then start Totalcmd.exe (one button!).
There is such an implementation in the mentioned TCIMG.
Not a scenario which makes sense for me.
I always use the x64 version and only for some tests
or using an old 32bit plugin I start the x86 version.
After stopping this I'm still in the x64 TC.
Windows 11 Home x64 Version 23H2 (OS Build 22631.3374)
TC 11.03 x64 / x86
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.2, Listary Pro 6.3.0.69
QAP 11.6.3.2 x64
Fla$her
Power Member
Power Member
Posts: 2244
Joined: 2020-01-18, 04:03 UTC

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

Post by *Fla$her »

2monarch-lfv

Code: Select all

;:::::::::::::::::::::: AU3 :::::::::::::::::::::::
; Restarting TC switching the x32<>x64 architecture
; Parameter in the Command field: "%COMMANDER_EXE%"
; Release date: 05/03/2019
;::::::::::::::::::::::::::::::::::::::::::::::::::
#NoTrayIcon
Local $hWnd = WinActive("[CLASS:TTOTAL_CMD]")
If $hWnd Then
  Opt("WinWaitDelay", 40)
  Local $TC = $CmdLine[1], $PFix = '', $n = 4
  WinClose($hWnd)
  ProcessWaitClose(WinGetProcess($hWnd))
  If @OSArch <> 'x86' Then
    If StringRight($TC, 6) = '64.EXE' Then
      $n = 6
    Else
      $PFix = '64'
    EndIf
  EndIf
  $PID = Run(StringLeft($TC, StringLen($TC) - $n) & $PFix & '.EXE')
  WinWaitActive("[CLASS:TTOTAL_CMD]")
  $WSS = ObjCreate('WScript.Shell')
  $WSS.AppActivate($PID)
EndIf
Overquoting is evil! 👎
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

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

Post by *petermad »

monarch-lfv wrote: 2022-10-02, 11:45 UTC Thanks! But I mean, one button, which change version TC "round trip". If executed Totalcmd.exe then start Totalcmd64.exe, and if executed Totalcmd64.exe then start Totalcmd.exe (one button!).
There is such an implementation in the mentioned TCIMG.
To make a toggle-button do this:

Put this command in your usercmd.ini file (located in the same dir as your wincmd.ini file, if not present make it):

Code: Select all

[em_othercommander]
cmd=%COMSPEC% /C
param=%Z%X if "%%COMMANDER_EXE%%"=="%%COMMANDER_PATH%%\TOTALCMD.EXE" (start "" "%%COMMANDER_PATH%%\TOTALCMD64.EXE" /N /P /A /i="%%COMMANDER_INI%%" %P%N* %T%M*) else start "" "%%COMMANDER_PATH%%\TOTALCMD.EXE" /N /P /A /i="%%COMMANDER_INI%%" %P%N* %T%M*
menu=Open opposite bitness of Total Commander
button=%COMMANDER_EXE%
iconic=1
And make a button with this command:

Code: Select all

TOTALCMD#BAR#DATA
em_othercommander, cm_Exit

%COMMANDER_EXE%
Open opposite bitness of Total Commander
To make the button:
1. Mark the text in the box here above (click SELECT ALL).
2. Copy it to the ClipBoard (press Ctrl+C).
3. Right click on TC's buttonbar and choose "Paste".

For this to work the 64bit and the 32bit version of TC of course has to be installed in the same directory.
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
Post Reply