But is it really needed? Opus has an admin mode toggle built-in, and when it is on any commands run in the window will be run as admin until it is turned off (either by clicking the toggle again, or by the specified timeout). You'd only need to do something extra if you wanted it to affect multiple Opus windows.
If it's launched from the same window that is in Admin Mode, it will be launched as admin.
(There are caveats, e.g. if the software is already running and the new instance you start just tells the old instance to open a new window, then the old instance will still be running in the same context it always was, and the new instance is gone after it sends a message to it.)
An easy way to test is to run cmd.exe since it tells you if it is running as administrator in the titlebar.
Thanks, Leo. You gave me the clue about what I was carelessly overlooking:
If it’s launched from the same window that is in Admin Mode, it will be launched as admin.
I had indeed been experimenting with the DOS box (amongst others) because that is very easy, as you say. But I had been elevating using a lister, then launching software through a floating toolbar --- the floating toolbar was, of course, not connected to the lister, so it didn't work.
I now find that when I launch using a button on the same lister, everything works as expected. Also, when you turn on 'Administrator mode' from a button palced on a floating toolbar, software launched by a subsequent instance of the same floating toolbar is not elevated (as one would expect).
So my original problem remains --- I was trying to use a global variable to insert the command modifier @Admin as a first line, or @Admin: in front of the command, an approach that worked perfectly with parameters such as NewTab in other DOpus commands (see my earlier post). Clearly modifiers work differently, which is what surprised me in the beginning.
As I said, no worries. I can script, or even easier, I can use a user-defined command with a conditional that insert @Admin explicitly if the global variable is non-empty.