"Close this terminal with Ctrl+D, press Enter to restart, OR CTRL+SHIFT+ENTER TO RESTART AS ADMIN." #21142

Open
opened 2026-01-31 07:34:21 +00:00 by claunia · 2 comments
Owner

Originally created by @e-t-l on GitHub (Jan 27, 2024).

Originally assigned to: @zadjii-msft on GitHub.

Description of the new feature/enhancement

When closeOnExit: "never", exiting a Terminal process outputs the message, "You can now close this terminal with Ctrl+D, or press Enter to restart." This enhancement is to suggest expanding this functionality with the self-explanatory, "or press Ctrl+Shift+Enter to restart as Administrator."

One example where this would be very helpful is when a user runs unelevated a CLI program, batch file, etc. that requires elevation to perform properly. This currently returns "Access is denied." and the user has to go relaunch the program with deliberate elevation (for example, by right-clicking the program shortcut and clicking "Run as administrator"). Instead, I propose that the user could simply press Ctrl+Shift+Enter to re-run the same command/program with elevation.

For a long time in Windows, users have been able to Ctrl+Shift+click on a batch file or shortcut to launch it elevated, or press Ctrl+Shift+Enter to run a command with elevation from the Win+R Run dialog. It would be consistent and intuitive UX to provide users a similar keyboard combination to elevate the command from within Terminal itself.

Proposed technical implementation details (optional)

I imagine this would involve something along the lines of replacing the current Terminal process/tab with one that is elevated to Administrator privileges but otherwise identical, and re-running the initial command that called it (if any).

Ideally it would also pass along any variables and such from the exited process. In this way, it would function similar to gsudo. (This bit, while more complex to implement, could partially address #146 as well.)

Originally created by @e-t-l on GitHub (Jan 27, 2024). Originally assigned to: @zadjii-msft on GitHub. <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> # Description of the new feature/enhancement When `closeOnExit: "never"`, exiting a Terminal process outputs the message, "You can now close this terminal with Ctrl+D, or press Enter to restart." This enhancement is to suggest expanding this functionality with the self-explanatory, "or press Ctrl+Shift+Enter to restart as Administrator." One example where this would be very helpful is when a user runs unelevated a CLI program, batch file, etc. that requires elevation to perform properly. This currently returns "Access is denied." and the user has to go relaunch the program with deliberate elevation (for example, by right-clicking the program shortcut and clicking "Run as administrator"). Instead, I propose that the user could simply press Ctrl+Shift+Enter to re-run the same command/program *with* elevation. For a long time in Windows, users have been able to Ctrl+Shift+click on a batch file or shortcut to launch it elevated, or press Ctrl+Shift+Enter to run a command with elevation from the Win+R Run dialog. It would be consistent and intuitive UX to provide users a similar keyboard combination to elevate the command from within Terminal itself. <!-- A clear and concise description of what the problem is that the new feature would solve. Describe why and how a user would use this new functionality (if applicable). --> # Proposed technical implementation details (optional) I imagine this would involve something along the lines of replacing the current Terminal process/tab with one that is elevated to Administrator privileges but otherwise identical, and re-running the initial command that called it (if any). Ideally it would also pass along any variables and such from the exited process. In this way, it would function similar to [gsudo](https://github.com/gerardog/gsudo). (This bit, while more complex to implement, could partially address #146 as well.) <!-- A clear and concise description of what you want to happen. -->
claunia added the Issue-FeatureNeeds-TriageNeeds-Tag-FixNeeds-Attention labels 2026-01-31 07:34:21 +00:00
Author
Owner

@zadjii-msft commented on GitHub (Feb 6, 2024):

Okay so jotting down some notes:

  • you've got a commandline that requires elevation to work right.
  • You stuck that in a profile.
  • you didn't set elevate: true on the profile with that commandline
  • when you opened a tab/pane with that profile, the command exited with an error (cause it wasn't elevated)
  • you want the error message to also give you a prompt to launch the profile as admin instead

I suppose the question I have is: why not just set elevate:true on the profile, if you've already got a command that you know requires admin permissions?

@zadjii-msft commented on GitHub (Feb 6, 2024): Okay so jotting down some notes: * you've got a `commandline` that requires elevation to work right. * You stuck that in a profile. * you **didn't** set `elevate: true` on the profile with that commandline * when you opened a tab/pane with that profile, the command exited with an error (cause it wasn't elevated) * you want the error message to _also_ give you a prompt to launch the profile as admin instead I suppose the question I have is: why not just set `elevate:true` on the profile, if you've already got a command that you know requires admin permissions?
Author
Owner

@e-t-l commented on GitHub (Feb 7, 2024):

Okay so jotting down some notes

...Did you, though? Because the 2nd and 3rd paragraphs of my post described multiple examples and use cases outside of the one specific scenario that your comment is about.

If I was unclear or if you'd like to discuss similar use cases in more detail, I'm more than happy to contribute to that discussion.

if you've already got a command that you know requires admin permissions?

To answer the question I'll assume you're asking in good faith: just like in the scenarios I described in my first post, this would be most useful for the typical user who runs a CLI app, batch file, or Win+R command without realizing it required elevation. The scenario you described, where a user deliberately launches Terminal.exe in a specific profile configuration, is not the focus of this issue.

@e-t-l commented on GitHub (Feb 7, 2024): > Okay so jotting down some notes ...Did you, though? Because the 2nd and 3rd paragraphs of my post described multiple examples and use cases outside of the one specific scenario that your comment is about. If I was unclear or if you'd like to discuss similar use cases in more detail, I'm more than happy to contribute to that discussion. > if you've already got a command that you know requires admin permissions? To answer the question I'll *assume* you're asking in good faith: just like in the scenarios I described in my first post, this would be most useful for the typical user who runs a **CLI app, batch file, or `Win+R` command without realizing it required elevation.** The scenario you described, where a user deliberately launches Terminal.exe in a specific profile configuration, is not the focus of this issue.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#21142