Can you add a cm command to restart TC?
Posted: 2022-09-07, 16:27 UTC
I usually use tcimg to restart TC, but sometimes it will not start after TC is closed.
Forum - Public Discussion and Support
https://www.ghisler.ch/board/
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%
THANK you very much for thispetermad 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
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".(PS: is there anyway to make TC load usercmd.ini from a userdefined folder like %Commander_Path%\Inis ?
Code: Select all
drive:\path\totalcmd64.exe /i=drive:\path\inis\wincmd.ini /f=drive:\path\inis\wcx_ftp.ini
Example: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)
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 filepetermad wrote: 2022-09-08, 00:15 UTCNo - 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".(PS: is there anyway to make TC load usercmd.ini from a userdefined folder like %Commander_Path%\Inis ?
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
Sorry I have no idea - I doubt very much that it is TC that has put it there.In my wincmd.ini under [Configuration] I have the key ‹L$÷A=6029370 you wouldnt by any change know what that is?
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: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
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
Not a scenario which makes sense for me.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.
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
To make a toggle-button do this: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.
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
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".