microsoft / microsoft/terminal

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

Open
#16,608 3 comments 4 reactions 1 assignee Claimed by @zadjii-msft View on GitHub
Issue-Feature Needs-Attention Needs-Tag-Fix Needs-Triage
Dominant language
C++
Stars
105k
Forks
9.6k
Avg merge
3d 17h
Merged PRs (30d)
29

Description

# 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](https://github.com/gerardog/gsudo). (This bit, while more complex to implement, could partially address #146 as well.)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.