Git Product home page Git Product logo

Comments (9)

kerol2r20 avatar kerol2r20 commented on May 25, 2024 3

Good idea!
I modify the naming at a7bbd8e

Thanks

from windows-terminal-context-menu.

Meegooo avatar Meegooo commented on May 25, 2024 2

This works for me

powershell -WindowStyle hidden -Command "Start-Process powershell -WindowStyle hidden -Verb RunAs -ArgumentList """"-Command C:\Users\Meegoo\AppData\Local\Microsoft\WindowsApps\wt.exe -p 'Windows PowerShell' -d '%V'"""""
Replace path to wt with your own (or just use wt, it should be a proper alias) and profile with ones you want.

If anyone can find a better way to escape quotes in this monstrocity, be my guest. Took me like an hour to figure those ones out. And implementing this in yet another powershell script isn't gonna be fun.
Also, might just be me, but first "-WindowStyle hidden" seems broken. It still shows me powershell window, albeit for a slightly shorter period of time. minimized also works badly, it starts as usual, and only then minimizes, making it even more annoying than hidden

Alternatively, you can add actual administrator profiles using third party executable and just use those as normal microsoft/terminal#1032 (comment). However, keep in mind that gsudo probably opens up some attack vectors because Windows doesn't exactly support this usecase

PS. Also, unfortunately, new tabs in elevated Terminal always start at C:\Windows\system32, this is a "Windows thing". So if this bothers you, elevated profiles from above should help.

from windows-terminal-context-menu.

kerol2r20 avatar kerol2r20 commented on May 25, 2024 1

I have tried the following method.
But all of them are failed.

  1. Add HasLUAShield for menu item
  2. Executable powershell command Start-Process wt.exe -Verb runAs

Does anyone have any suggestion?

from windows-terminal-context-menu.

kerol2r20 avatar kerol2r20 commented on May 25, 2024 1

Hi all,

I have implemented this function.
You can give it a try 4fe75b6 😉

The RunAs item is closed by default, you have to turn it on in config.json
Such like that

{
    "profiles": {
        "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}": {
            "showRunAs": true
        }
    }
}

Thanks

from windows-terminal-context-menu.

A-Sparowe avatar A-Sparowe commented on May 25, 2024

This ^

from windows-terminal-context-menu.

xmha97 avatar xmha97 commented on May 25, 2024

Thanks

from windows-terminal-context-menu.

kerol2r20 avatar kerol2r20 commented on May 25, 2024

Thank you @Meegooo
I love gsudo solution, it's a simple way.
But gsudo is a external program, this make this script no independent.

from windows-terminal-context-menu.

felipecrs avatar felipecrs commented on May 25, 2024

For me it currently shows Run as PowerShell:

image

I'd suggest you to put PowerShell (Admin), so then it would look like the native Windows Win+X menu:

image

from windows-terminal-context-menu.

felipecrs avatar felipecrs commented on May 25, 2024

Awesome!

image

from windows-terminal-context-menu.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.