Admin mode: Parameter(s) in MenuItem fail
Moderators: Hacker, petermad, Stefan2, white
Admin mode: Parameter(s) in MenuItem fail
Hi TC Community
Parameters in TC Custom ButtonBar such as %X, %P and %T work as expected, however when i run the item "As Administrator" (by right click and choose "As Administrator") it fails.
How to reproduce
1) Create a simple TestParm.cmd script like:
---
@echo off
echo.Parm 1: %1
echo.Parm 2: %2
echo.Parm 3: %3
---
2) Create a Custom ButtonBar that calls it:
---
Command: TestParm.cmd CLONE
Parameters:
---
3) Run the MenuItem normally (left click Custom ButtonBar) results CMD.exe with text something like:
---
Parm 1: CLONE
Parm 2:
Parm 3:
Press any key to continue . . .
---
4) Change TestParm.cmd Custom ButtonBar to add parameters:
---
Command: TestParm.cmd CLONE
Parameters: "%X%P" "%T"
---
5) Run the Custom ButtonBar normally (left click Custom ButtonBar) results CMD.exe with text something like:
Parm 1: CLONE
Parm 2: "C:\"
Parm 3: "D:\"
Press any key to continue . . .
---
runs CMD fine
6) Now run the TestParm.cmd Custom ButtonBar "As Administrator" (by right click and choose "As Administrator"): fails: no cmd, no prompt, only a short flash.
by doing 6) i expect the TestParm to run like 5) and in admin mode.
Parameters in TC Custom ButtonBar such as %X, %P and %T work as expected, however when i run the item "As Administrator" (by right click and choose "As Administrator") it fails.
How to reproduce
1) Create a simple TestParm.cmd script like:
---
@echo off
echo.Parm 1: %1
echo.Parm 2: %2
echo.Parm 3: %3
---
2) Create a Custom ButtonBar that calls it:
---
Command: TestParm.cmd CLONE
Parameters:
---
3) Run the MenuItem normally (left click Custom ButtonBar) results CMD.exe with text something like:
---
Parm 1: CLONE
Parm 2:
Parm 3:
Press any key to continue . . .
---
4) Change TestParm.cmd Custom ButtonBar to add parameters:
---
Command: TestParm.cmd CLONE
Parameters: "%X%P" "%T"
---
5) Run the Custom ButtonBar normally (left click Custom ButtonBar) results CMD.exe with text something like:
Parm 1: CLONE
Parm 2: "C:\"
Parm 3: "D:\"
Press any key to continue . . .
---
runs CMD fine
6) Now run the TestParm.cmd Custom ButtonBar "As Administrator" (by right click and choose "As Administrator"): fails: no cmd, no prompt, only a short flash.
by doing 6) i expect the TestParm to run like 5) and in admin mode.
Last edited by Robbie on 2024-07-18, 13:40 UTC, edited 5 times in total.
Re: Admin mode: Parameter(s) in MenuItem fail
"""fails"""" >> what does that means?
What do you expect to get and what do you get instead?
Re: Admin mode: Parameter(s) in MenuItem fail
Do you mean by adding * in front of the command?
In that case use this for the command:
Code: Select all
*"%comspec%" /c call "c:\yourpath\testparam.cmd" CLONE
Warning: If Total Commander is not run as an administrator, be aware of the following issues when running programs as an administrator:
* Environment variables specific to Total Commander (like %COMMANDER_PATH%) will not be inherited by the programs.
* In most Windows versions, the programs will not run in the folder indicated by the "Start path" field.
* If the program is a batch file (.bat or .cmd file), you may need to precede it with cmd.exe /c.
Re: Admin mode: Parameter(s) in MenuItem fail
more info provided in first post
Re: Admin mode: Parameter(s) in MenuItem fail
Can you rightclick a menu item? Do you perhaps mean a buttonbar shown as menu?Robbie wrote: 2024-07-18, 11:21 UTC Run the MenuItem "As Administrator" (Right click and choose "As Administrator"): fails: no cmd no prompt only a short flash.
Anyhow, use the command I gave without the leading * character.
Re: Admin mode: Parameter(s) in MenuItem fail
TY *white
"%comspec% /c TestParm.cmd CLONE" did the trick!
i now created an fully functional user added functionality to clone my TC instance (with paths) with or without admin rights! Again TY for support!
"%comspec% /c TestParm.cmd CLONE" did the trick!
i now created an fully functional user added functionality to clone my TC instance (with paths) with or without admin rights! Again TY for support!
- ghisler(Author)
- Site Admin
- Posts: 50390
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Re: Admin mode: Parameter(s) in MenuItem fail
Moderator message
Moved to English forum.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
Re: Admin mode: Parameter(s) in MenuItem fail
2white
If you right click a button, there is an option: "As Administrator".
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Re: Admin mode: Parameter(s) in MenuItem fail
The following button works in any mode.
It starts a new admin instance from a normal TC
and also starts a new admin instance form inside an Admin TC
The path and cursor position of both sides are preserved on the new instances.
It starts a new admin instance from a normal TC
and also starts a new admin instance form inside an Admin TC
The path and cursor position of both sides are preserved on the new instances.
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 TC as Admin
0
-1
Windows 11 Home, Version 24H2 (OS Build 26100.3915)
TC 11.51 x64 / x86
Everything 1.5.0.1391a (x64), Everything Toolbar 1.5.2.0, Listary Pro 6.3.2.88
QAP 11.6.4.2.1 x64
TC 11.51 x64 / x86
Everything 1.5.0.1391a (x64), Everything Toolbar 1.5.2.0, Listary Pro 6.3.2.88
QAP 11.6.4.2.1 x64
Re: Admin mode: Parameter(s) in MenuItem fail
Hi *Horst.Epp
TY. The star makes the clone to ALWAYS run in admin mode while i want it as an OPTION.
TY. The star makes the clone to ALWAYS run in admin mode while i want it as an OPTION.
Re: Admin mode: Parameter(s) in MenuItem fail
2Robbie
Then use this button:The star makes the clone to ALWAYS run in admin mode while i want it as an OPTION.
Code: Select all
TOTALCMD#BAR#DATA
%COMMANDER_EXE% /N /P /A /i="%COMMANDER_INI%"
%Z%X %P%N* %T%M*
%COMMANDER_EXE%
Open New Instance of Total Commander
And use the right-click menu on the button to start as Administrator.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".
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Re: Admin mode: Parameter(s) in MenuItem fail
Hi *petermad
Great, this works also! Btw copy/paste action on the TC's buttonbar is new to me. TY!
Great, this works also! Btw copy/paste action on the TC's buttonbar is new to me. TY!