Admin mode: Parameter(s) in MenuItem fail

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
Robbie
Junior Member
Junior Member
Posts: 38
Joined: 2008-03-18, 14:27 UTC

Admin mode: Parameter(s) in MenuItem fail

Post by *Robbie »

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.
Last edited by Robbie on 2024-07-18, 13:40 UTC, edited 5 times in total.
User avatar
Stefan2
Power Member
Power Member
Posts: 4281
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: Admin mode: Parameter(s) in MenuItem fail

Post by *Stefan2 »

Robbie wrote: 2024-07-18, 11:21 UTC run the MenuItem "As Administrator": fails.

"""fails"""" >> what does that means?

What do you expect to get and what do you get instead?






 
User avatar
white
Power Member
Power Member
Posts: 5753
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Admin mode: Parameter(s) in MenuItem fail

Post by *white »

Robbie wrote: 2024-07-18, 11:21 UTC run the MenuItem "As Administrator": fails.
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
This is not explained in the help page Dialog box: Change start menu, but in the help page Dialog box: Configuration - Change button bar:
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.
Robbie
Junior Member
Junior Member
Posts: 38
Joined: 2008-03-18, 14:27 UTC

Re: Admin mode: Parameter(s) in MenuItem fail

Post by *Robbie »

more info provided in first post
User avatar
white
Power Member
Power Member
Posts: 5753
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Admin mode: Parameter(s) in MenuItem fail

Post by *white »

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.
Can you rightclick a menu item? Do you perhaps mean a buttonbar shown as menu?
Anyhow, use the command I gave without the leading * character.
Robbie
Junior Member
Junior Member
Posts: 38
Joined: 2008-03-18, 14:27 UTC

Re: Admin mode: Parameter(s) in MenuItem fail

Post by *Robbie »

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!
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50390
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Admin mode: Parameter(s) in MenuItem fail

Post by *ghisler(Author) »

Moderator message

Moved to English forum.
Author of Total Commander
https://www.ghisler.com
User avatar
petermad
Power Member
Power Member
Posts: 16009
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Admin mode: Parameter(s) in MenuItem fail

Post by *petermad »

2white
white wrote: 2024-07-18, 13:32 UTC Can you rightclick a menu item?
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
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6954
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: Admin mode: Parameter(s) in MenuItem fail

Post by *Horst.Epp »

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.

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
Robbie
Junior Member
Junior Member
Posts: 38
Joined: 2008-03-18, 14:27 UTC

Re: Admin mode: Parameter(s) in MenuItem fail

Post by *Robbie »

Hi *Horst.Epp

TY. The star makes the clone to ALWAYS run in admin mode while i want it as an OPTION.
User avatar
petermad
Power Member
Power Member
Posts: 16009
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Admin mode: Parameter(s) in MenuItem fail

Post by *petermad »

2Robbie
The star makes the clone to ALWAYS run in admin mode while i want it as an OPTION.
Then use this button:

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
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".
And use the right-click menu on the button to start 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
Robbie
Junior Member
Junior Member
Posts: 38
Joined: 2008-03-18, 14:27 UTC

Re: Admin mode: Parameter(s) in MenuItem fail

Post by *Robbie »

Hi *petermad

Great, this works also! Btw copy/paste action on the TC's buttonbar is new to me. TY!
Post Reply