Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Failure of /unelevated Option with START

Jun
1,092
48
I don't know if this is some kind of bug or just something inherent in Windows. I'm trying to start a ConPTY standalone TCC session from an elevated TCC tab in TCMD using the following command:

Code:
start /unelevated /pgm wt %@quote[%_cmdspec]

It does create a ConPTY session, but it is elevated, despite the /unelevated switch. The same command from an unelevated TCC tab works fine.

If I do not load Windows Terminal but directly load TCC with the following command, I do get an unelevated session, but, of course, it is non-ConPTY.

Code:
start /unelevated /pgm %@quote[%_cmdspec]
 
Packaged apps (like WT) have their own startup routines, apparently defeating START's efforts to make it unelevated. I can reproduce your problem with my own RUNDOWN.EXE which uses Raymond Chen's spoof_the_parent_id method; it doesn't work on the WT alias or the actual windowsterminal.exe app. You can get the desired result with runas /trustlevel:0x20000 "wt %comspec". But if %COMSPEC needs quoting that will probably not work. If WT has a "TCC36" (or whatever) profile, runas /trustlevel:0x20000 "wt -p TCC36" should work.
 
I have no idea what all that means and assumed that what you wrote was intended as shorthand for start /runas trustlevel:0x20000. When I add that /runas switch to the command line, I get an error message: The user name or password is incorrect.

In any case, this is not really something I have any actual need for. I was just trying to make my TCC.BTM script complete and able to create every kind of session possible from a TCC tab or standalone session.

Oh, I just figured out that you really meant what you wrote, to issue the "runas" command, which I was not familiar with. I set up a profile in WT as you hinted (I have never used Windows Terminal other than by default when TCC opens in it by default, but I figured out how to create a profile and make it the default).

Now I can, indeed, run the command runas /trustlevel:0x20000 wt from an elevated TCC session and get a non-elevated, ConPTY TCC session running in Windows Terminal.
 
Your trick also works if you use the short file name for the TCC command:

Code:
runas /trustlevel:0x20000 "wt %@sfn[%_cmdspec]"
 
Back
Top