-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'Run profile as admin' ignored when running bat or cmd directly (double-clicking) #17859
Comments
Nope, if I use a shortcut as shown in your image, it will open in a conhost window. On my previous Windows 10 laptop I was using 2 days ago, if I double-clicked directly on a bat or cmd file, it would ask me for elevation and run in an elevated Terminal window - I was just wanting the same behaviour on my new laptop. The only setting I changed on my old laptop to make this happen was 'Run profile as administrator' - then it functioned as described - I've been using it that way for over 2 years. EDIT: On my new laptop, if I right-click and run as admin, it will run in a conhost window. If I double-click, it will run in a standard Terminal session. The bat files themselves serve only as launchers for PowerShell scripts, so the files themselves are literally just: |
20240904.143352-new.mp4 |
That's... definitely not supposed to happen 😨 When you get the UAC prompt for the Terminal, what's the commandline it shows? (under "Show more details") |
huh. That's wacky. It
So what ends up running is a second copy of that batch script, with the original one presumably terminating early when the original terminal process exits. That's super weird. That is on 1.20, but I don't think we changed that in 1.21. Most recent changes there are:
Unless we're just not matching this commandline anymore, but I'd doubt that. Could you manually install a 1.20 Terminal on your win11 machine, and see if that works the same as before? Or inversely, a 1.21 Terminal on win10? I cannot imagine that the handoff logic that's in the OS is different between those two OS versions. |
I've had this behaviour going back quite a long way - it survived many updates. |
Terminal's been an MSIX "store package" since our earliest release - 0.2, so I doubt it's that. I just want to try and narrow down where the delta happened that regressed this scenario for you. What's the profile in your settings.json with the |
Apologies - did you want the settings.json file itself or something else as well? |
Yea the settings.json file would be good enough |
still relevant AFAIK |
@1EDExg0ffyXfTEqdIUAYNZGnCeajIxMWd2vaQeP if you're hitting this too, then the same question applies to you |
Windows Terminal version
1.21.2361.0
Windows build number
10.0.22631.0
Other Software
No response
Steps to reproduce
Change default profile setting to enable 'Run profile as administrator' then try and open a batch file or cmd file by double-clicking on it.
Caveat - I am logged into Windows as a standard user but need to run scripts under a separate admin account. Terminal is installed for both the standard and admin user.
Extra context - I upgraded from a Windows 10 to a Windows 11 laptop - everything else works fine, this is the only thing I can't get functioning as it did before.
Expected Behavior
To double-click on the bat or cmd file and be prompted for elevation and the bat or cmd to launch in an elevated Terminal window.
This is how it functioned on my old laptop.
Actual Behavior
I am not prompted for elevation and the bat or cmd file opens in a standard session.
If Terminal is run directly, or the + is pressed for a new tab, only then am I prompted for elevation.
The text was updated successfully, but these errors were encountered: