Admin shortcuts do not open in Terminal Preview #14043

Closed
opened 2026-01-31 03:59:14 +00:00 by claunia · 10 comments
Owner

Originally created by @obrobrio2000 on GitHub (May 29, 2021).


Note

: 📌 Pinned comment: https://github.com/microsoft/terminal/issues/10276#issuecomment-852215012


Windows Terminal version (or Windows build number)

10.0.21390.1, 1.9.1445.0

Other Software

No response

Steps to reproduce

  1. Set WT Preview as the default terminal application following the steps described here;
  2. Launch CMD/PS as administrator.

Expected Behavior

Elevated CMD/PS should respect the default terminal choice just like when non-elevated.

Actual Behavior

CMD/PS open in Terminal only if launched with standard privileges. When launched as administrator they still open in Console Host.
Feedback Hub link: https://aka.ms/AAcrn4y

Originally created by @obrobrio2000 on GitHub (May 29, 2021). <hr> > **Note**: 📌 Pinned comment: **https://github.com/microsoft/terminal/issues/10276#issuecomment-852215012** <hr> ### Windows Terminal version (or Windows build number) 10.0.21390.1, 1.9.1445.0 ### Other Software _No response_ ### Steps to reproduce 1) Set WT Preview as the default terminal application following the steps described [here](https://devblogs.microsoft.com/commandline/windows-terminal-preview-1-9-release/); 2) Launch CMD/PS as administrator. ### Expected Behavior Elevated CMD/PS should respect the default terminal choice just like when non-elevated. ### Actual Behavior CMD/PS open in Terminal only if launched with standard privileges. When launched as administrator they still open in Console Host. Feedback Hub link: https://aka.ms/AAcrn4y
Author
Owner

@DHowett commented on GitHub (Jun 1, 2021):

Unfortunately, this is by design right now. Due to a limitation in the app platform it is impossible for Terminal to be "discovered" as the handler when the application that needs a terminal is running elevated.

This is tracked internally at MSFT:39500755. There's a decent amount of platform work that will be needed for this.

@DHowett commented on GitHub (Jun 1, 2021): Unfortunately, this is by design right now. Due to a limitation in the app platform it is impossible for Terminal to be "discovered" as the handler when the application that needs a terminal is running elevated. This is tracked internally at MSFT:39500755. There's a decent amount of platform work that will be needed for this.
Author
Owner

@xparadoxical commented on GitHub (Mar 29, 2023):

just bumped my head into gerardog/gsudo#117 and, by extension, this. 😔

@xparadoxical commented on GitHub (Mar 29, 2023): just bumped my head into gerardog/gsudo#117 and, by extension, this. 😔
Author
Owner

@zadjii-msft commented on GitHub (Aug 28, 2023):

As a 2023 status update: This still doesn't seem to be supported by the platform. We're not sure when the COM team will be able to fix this.

edit to include some search phrases: defterm elevated admin COM handoff defapp

@zadjii-msft commented on GitHub (Aug 28, 2023): As a 2023 status update: This still doesn't seem to be supported by the platform. We're not sure when the COM team will be able to fix this. edit to include some search phrases: defterm elevated admin COM handoff defapp
Author
Owner

@stdin82 commented on GitHub (Dec 3, 2023):

As a 2023 status update: This still doesn't seem to be supported by the platform. We're not sure when the COM team will be able to fix this.

I don't think this should be implemented (fixed) before providing a way to detect if the current cmd or powershell is running within Terminal
e.g. when a batch script or powershell script is launched from explorer, WT_SESSION/WT_PROFILE are not set
currently, "Run as administrator" is the only reliable way to avoid Terminal, which is good (well, unless UAC is disabled, then all opens in Terminal)

@stdin82 commented on GitHub (Dec 3, 2023): > As a 2023 status update: This still doesn't seem to be supported by the platform. We're not sure when the COM team will be able to fix this. I don't think this should be implemented (fixed) before providing a way to detect if the current cmd or powershell is running within Terminal e.g. when a batch script or powershell script is launched from explorer, WT_SESSION/WT_PROFILE are not set currently, "Run as administrator" is the only reliable way to avoid Terminal, which is good (well, unless UAC is disabled, then all opens in Terminal)
Author
Owner

@DHowett commented on GitHub (Dec 4, 2023):

the only reliable way to avoid Terminal,

We're going to fix this in the Windows platform eventually, at which point it will not be reliable at all.
There are much more reliable methods, which are officially supported.

  1. Launch conhost directly.
  2. In any of the three settings pages available for this, set the "Default Terminal" application back to "Windows Console Host". This will persist across upgrades, and is in fact the intended way to "avoid" Terminal.
@DHowett commented on GitHub (Dec 4, 2023): > the only reliable way to avoid Terminal, We're going to fix this in the Windows platform eventually, at which point it will not be reliable at all. There are much more reliable methods, which are officially supported. 1. Launch `conhost` directly. 2. In any of the three settings pages available for this, set the "Default Terminal" application back to "Windows Console Host". This will persist across upgrades, and is in fact the intended way to "avoid" Terminal.
Author
Owner

@Echostorm44 commented on GitHub (Aug 5, 2024):

A year later, any update on this? Still an issue in VS2022 and Windows 11.

@Echostorm44 commented on GitHub (Aug 5, 2024): A year later, any update on this? Still an issue in VS2022 and Windows 11.
Author
Owner

@michalsteyn commented on GitHub (Aug 23, 2024):

This issue has now been open for over 3 years. Shocking this is taking soo long. For Dev's running VS 2022 as Admin, this is really a pain.

@michalsteyn commented on GitHub (Aug 23, 2024): This issue has now been open for over 3 years. Shocking this is taking soo long. For Dev's running VS 2022 as Admin, this is really a pain.
Author
Owner

@ayanamist commented on GitHub (Sep 14, 2024):

I see some workarounds (in chinese), maybe help:
https://t.me/yscschan/7010
https://t.me/yscschan/7014?single

@ayanamist commented on GitHub (Sep 14, 2024): I see some workarounds (in chinese), maybe help: https://t.me/yscschan/7010 https://t.me/yscschan/7014?single
Author
Owner

@PogromistDev commented on GitHub (Nov 10, 2024):

Visual studio developer command prompt runs in terminal only if you already run terminal as administrator and then executed "Developer Command Prompt for VS 2022" .lnk file or just passed its command directly
%comspec% /k "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\VsDevCmd.bat" -arch=amd64

@PogromistDev commented on GitHub (Nov 10, 2024): Visual studio developer command prompt runs in terminal only if you already run terminal as administrator and then executed "Developer Command Prompt for VS 2022" .lnk file or just passed its command directly `%comspec% /k "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\VsDevCmd.bat" -arch=amd64`
Author
Owner

@Dovias commented on GitHub (Apr 18, 2025):

I see some workarounds (in chinese), maybe help: https://t.me/yscschan/7010 https://t.me/yscschan/7014?single

For anyone wondering how to make this work for now until this gets fixed, you can follow my guide (which is based on the yscshan's findings) which explains how to make Windows Terminal to open when executing PowerShell or Command Prompt executable as an administrator:
https://gist.github.com/Dovias/75338df14f3fbab19b72eefb7fb9b884

https://github.com/user-attachments/assets/ae4a8ee9-eff4-4846-a42e-898191cf179a

@Dovias commented on GitHub (Apr 18, 2025): > I see some workarounds (in chinese), maybe help: https://t.me/yscschan/7010 https://t.me/yscschan/7014?single For anyone wondering how to make this work for now until this gets fixed, you can follow my guide (which is based on the yscshan's findings) which explains how to make Windows Terminal to open when executing PowerShell or Command Prompt executable as an administrator: https://gist.github.com/Dovias/75338df14f3fbab19b72eefb7fb9b884 https://github.com/user-attachments/assets/ae4a8ee9-eff4-4846-a42e-898191cf179a
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#14043