How to elevate PowerShell without closing the actual one? [duplicate]

This is something that tends to happen that involves trying to run a command such as "rm -r" or something similar, and you realize you are not elevated to admin rights on that PowerShell window.

Normally you'll have to open the start menu, select the PowerShell icon, and right click it to select "run as admin".

How do I avoid all those steps?

0

1 Answer

To do so is very easy! Just run the command within the same PowerShell that states:

Start-Process powershell -Verb runAs

And voila! UAC will prompt you and you'll have a new window from where you can execute the command you want.

1

You Might Also Like