Skip to content
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

Option to run various shells as Administrator #5

Open
alexandruboboc opened this issue Mar 30, 2017 · 2 comments
Open

Option to run various shells as Administrator #5

alexandruboboc opened this issue Mar 30, 2017 · 2 comments

Comments

@alexandruboboc
Copy link

alexandruboboc commented Mar 30, 2017

Hi. Love your plugin, thanks for offering it for free.

I am wondering, how could I run PowerShell as Administrator inside VSC?

From windows cmd, I can do this:
powershell -Command "Start-Process PowerShell -Verb RunAs"

or I can run this when in PowerShell:
Start-Process PowerShell -Verb RunAs.

and both sollutions give me a new PowerShell window as Administrator.

So I gave this a go:

        {
            "shell": "C:\\Windows\\sysnative\\WindowsPowerShell\\v1.0\\powershell.exe",
            "args": ["Start-Process PowerShell -Verb RunAs"],
            "label": "PowerShell (Administrator)"
        }

And it starts a PowerShell terminal as Administrator, but in a new window outside of VSC.

Any suggestions?

@Tyriar
Copy link
Owner

Tyriar commented Mar 30, 2017

I'd love to add this if we figure it out, the challenge is getting powershell/cmd to run as admin within the same window. My thinking here was that we'd need to use some combination of runas.exe, cmd /c or start to solve this generically.

@Tyriar Tyriar changed the title PowerShell as Administrator? Option to run various shells as Administrator Mar 30, 2017
@soulshined
Copy link

soulshined commented Jun 21, 2018

Hi there I know this is a year late, but I just skimmed through the issues on this repo and can offer a real simple workaround for future readers, that may or may not suit you. If you run Visual Code as administrator, that cascades down to the integrated, or otherwise, terminals. In other words, it inherits admin rights thanks to UAC. You can do this on a single instance of running, by right clicking VS Code + "run as administrator", or there or numerous ways you can google to always run Visual Code as administrator. Either way that you see fit, the terminal will also run as administrator.

I think this is probably a more suitable alternative, as you won't need to edit syntax for circumstantial workspace settings, but too each their own. Just a suggestion for those looking

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants