Start admin instance of TC with params from normal TC

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6480
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Start admin instance of TC with params from normal TC

Post by *Horst.Epp »

To ask a riddle :)
I have a button to run a new TC instance with higher rights.
The new instance should start with the same pathes on the left and right side !
regardless what the current active side is.
My current solution always swaps the windows.

Code: Select all

TOTALCMD#BAR#DATA
*%COMMANDER_EXE%
/N /A /X "%P%N" "%T"
%COMMANDER_PATH%\TCMADM64.EXE
TC x64 as Admin


-1
Windows 11 Home x64 Version 23H2 (OS Build 22631.3447)
TC 11.03 x64 / x86
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.3, Listary Pro 6.3.0.73
QAP 11.6.3.2 x64
User avatar
HolgerK
Power Member
Power Member
Posts: 5406
Joined: 2006-01-26, 22:15 UTC
Location: Europe, Aachen

Re: Start admin instance of TC with params from normal TC

Post by *HolgerK »

/L="%X%P%N" /R="%X%T%M"
Help wrote:%X Interprets the following parameters after this parameter as left/right instead of source/target:
%P, %p (left path), %T, %t (right path), %N, %n (left name), %M, %m (right name),
%S, %s (left selected), %R, %r (right selected)
Example: %X%P %T sends left and right path to e.g. an external sync tool
%x Interprets the following parameters after this parameter again as source/target
Example: %X%P %x%P sends left and source path to the called program
HTH
Holger
Make our planet great again
User avatar
petermad
Power Member
Power Member
Posts: 14791
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Start admin instance of TC with params from normal TC

Post by *petermad »

This command does the trick for me:

Code: Select all

[em_newcommander_admin]
cmd=*%COMMANDER_EXE% /N /P /A /i="%COMMANDER_INI%"
param=%Z%X %P%N* %T%M*
menu=Open New Instance of Total Commander as Administrator
button=%COMMANDER_EXE%
You need TC 10.50 or newer.
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
Horst.Epp
Power Member
Power Member
Posts: 6480
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: Start admin instance of TC with params from normal TC

Post by *Horst.Epp »

Thanks to petermad and HolgerK.
Both solutions work fine.
I stay with HolgerKs one which doesn't need an em_command

My full button now looks like this

Code: Select all

TOTALCMD#BAR#DATA
*%COMMANDER_EXE%
/N /A /L="%X%P%N" /R="%X%T%M"
%COMMANDER_PATH%\TCMADM64.EXE
TC x64 as Admin


-1
Windows 11 Home x64 Version 23H2 (OS Build 22631.3447)
TC 11.03 x64 / x86
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.3, Listary Pro 6.3.0.73
QAP 11.6.3.2 x64
User avatar
HolgerK
Power Member
Power Member
Posts: 5406
Joined: 2006-01-26, 22:15 UTC
Location: Europe, Aachen

Re: Start admin instance of TC with params from normal TC

Post by *HolgerK »

2petermad
Nice one.
- Quotes are not needed for %P%N and %T%M (and may even be contra productive)
- /i="%COMMANDER_INI%" allows you to use the same ini as the normal user in case you don't use "UseIniInProgramDir=7"
- %X could be placed once before the paths
- %Z prevents error messages like

Code: Select all

---------------------------
Total Commander
---------------------------
This function cannot be used with packed files!
---------------------------
OK
---------------------------
if TC stay inside an archive

But what is the point of appending an asterix * to the two paths?

Regards
Holger
Make our planet great again
User avatar
petermad
Power Member
Power Member
Posts: 14791
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Start admin instance of TC with params from normal TC

Post by *petermad »

2HolgerK
But what is the point of appending an asterix * to the two paths?
It is for the /P parameter to prevent TC from going updir if the cursor is placed in on the [..] entry. See: viewtopic.php?p=412884#p412884
Last edited by petermad on 2022-11-20, 12:38 UTC, edited 3 times 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
User avatar
petermad
Power Member
Power Member
Posts: 14791
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Start admin instance of TC with params from normal TC

Post by *petermad »

2Horst.Epp
I stay with HolgerKs one which doesn't need an em_command
OK - here it is as a button without an em_command:

Code: Select all

TOTALCMD#BAR#DATA
*%COMMANDER_EXE% /N /P /A /i="%COMMANDER_INI%"
%Z%X %P%N* %T%M*
%COMMANDER_PATH%\TCMADM64.EXE
Open New Instance of Total Commander as Administrator


-1
Notice that Holgers solution goes into subdirectories if the cursor is on such.
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
Horst.Epp
Power Member
Power Member
Posts: 6480
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: Start admin instance of TC with params from normal TC

Post by *Horst.Epp »

2petermad
You are right (as always) :)
Now I use your new one without em_command :D
Windows 11 Home x64 Version 23H2 (OS Build 22631.3447)
TC 11.03 x64 / x86
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.3, Listary Pro 6.3.0.73
QAP 11.6.3.2 x64
User avatar
HolgerK
Power Member
Power Member
Posts: 5406
Joined: 2006-01-26, 22:15 UTC
Location: Europe, Aachen

Re: Start admin instance of TC with params from normal TC

Post by *HolgerK »

petermad wrote: 2022-11-20, 11:33 UTC It is for the /P parameter to prevent TC from going updir if the cursor is placed in on the [..] entry. See: viewtopic.php?p=412884#p412884
Aah, i see. Tricky;-)
Thanks for the info.

Regards
Holger
Make our planet great again
Post Reply