Give administrator privileges to existing powershell

Having a powershell opened, it's possible to give it administrator priviledges ?

It's embedded in an IDE (Visual Studio Code) and I don't want to open a new terminal everytime I do something that needs administrator priviledges (like npm install ... --save-dev)

If not, can I set VS Code to open terminals with administrator priviledges ?


Solution 1:

Since my suggestion(comment) has worked for the OP, I'm posting this as an answer

Launch the VSCode as an administrator, so that the integrated powershell also gets the admin privileges as you expected.

Instead every time you right-click and "Run as administrator", navigate to the installation folder of the VSCode program, and do as the following demonstration shows. enter image description here

Note: The files you create this way within VSCode are then also owned by the administrator. This probably isn't an issue in most of the cases. But there are scenarios where this, at least, creates a higher effort for you when handling those files.