DEV Community

Cover image for How to use Sudo in Windows 10 Powershell
Ashraf Mehdaly
Ashraf Mehdaly

Posted on

18 4

How to use Sudo in Windows 10 Powershell

Many of us may face a small problem with windows terminal (command line) when going to execute some commands that require an admin privilege while the shell is opened in normal user privilege, so we have to restart the shell using Run As Administrator in order to proceed, whilst in Linux we simply use sudo command to execute whatever we want as a root user.
Here we have solution for this issue in Windows, just follow the following steps:
1- Using PowerShell terminal execute the following command line to install scoop package installer:

C:\>iwr -useb get.scoop.sh | iex
Enter fullscreen mode Exit fullscreen mode

2- Then after installing "scoop" in your system install "sudo" package:

C:\>scoop install sudo
Enter fullscreen mode Exit fullscreen mode

Now you will be able to use sudo command same as in Linux, for example in order to install npm package globally we have to run npm install in a privilege mode:

C:\>sudo npm install –g bootstrap
Enter fullscreen mode Exit fullscreen mode

As well as having a sudo option in Windows, we will have the ability to install packages in Windows using "scoop" similar to apt & apt-get in Linux.
For more information how to use scoop visit :

  1. https://scoop.sh/
  2. https://github.com/lukesampson/scoop/wiki

AWS Q Developer image

What is MCP? No, Really!

See MCP in action and explore how MCP decouples agents from servers, allowing for seamless integration with cloud-based resources and remote functionality.

Watch the demo

Top comments (2)

Collapse
 
narayanbhat166 profile image
Narayanbhat166

Very much useful. Thanks for this information

Collapse
 
kkkkkccccc profile image
Keemchard Tamio

thanks

Dev Diairies image

User Feedback & The Pivot That Saved The Project

🔥 Check out Episode 3 of Dev Diairies, following a successful Hackathon project turned startup.

Watch full video 🎥

👋 Kindness is contagious

Discover fresh viewpoints in this insightful post, supported by our vibrant DEV Community. Every developer’s experience matters—add your thoughts and help us grow together.

A simple “thank you” can uplift the author and spark new discussions—leave yours below!

On DEV, knowledge-sharing connects us and drives innovation. Found this useful? A quick note of appreciation makes a real impact.

Okay