Windows how to run cmd as administrator

How do I open a elevated command prompt using command lines on a normal cmd? For example, I use runas /username:admin cmd but the cmd that was opened does not seem to be elevated! Any solutions?

I ran into the same problem and the only way I was able to open the CMD as administrator from CMD was doing the following:

  1. Open CMD
  2. Write powershell -Command "Start-Process cmd -Verb RunAs" and press Enter
  3. A pop-up window will appear asking to open a CMD as administrator

Felix Dombek's user avatar

Felix Dombek

13.3k17 gold badges78 silver badges127 bronze badges

answered Aug 26, 2015 at 1:05

Gui's user avatar

GuiGui

2,2271 gold badge11 silver badges3 bronze badges

6

I don’t have enough reputation to add a comment to the top answer, but with the power of aliases you can get away with just typing the following:

powershell "start cmd -v runAs"

This is just a shorter version of user3018703 excellent
solution:

powershell -Command "Start-Process cmd -Verb RunAs"

answered Nov 10, 2018 at 9:29

Stiegler's user avatar

StieglerStiegler

6896 silver badges8 bronze badges

1

Simple way I did after trying other answers here

Method 1: WITHOUT a 3rd party program (I used this)

  1. Create a file called sudo.bat (you can replace sudo with any name you want) with following content

    powershell.exe -Command "Start-Process cmd "/k cd /d %cd%" -Verb RunAs"
  2. Move sudo.bat to a folder in your PATH; if you don’t know what that means, just move these files to c:windows
  3. Now sudo will work in Run dialog (win+r) or in explorer address bar (this is the best part :))

Method 2: WITH a 3rd party program

  1. Download NirCmd and unzip it.
  2. Create a file called sudo.bat (you can replace sudo with any name you want) with following content

    nircmdc elevate cmd /k "cd /d %cd%"
  3. Move nircmdc.exe and sudo.bat to a folder in your PATH; if you don’t know what that means, just move these files to c:windows
  4. Now sudo will work in Run dialog (win+r) or in explorer address bar (this is the best part :))

answered Oct 29, 2016 at 16:40

Dheeraj Bhaskar's user avatar

Dheeraj BhaskarDheeraj Bhaskar

18.4k9 gold badges63 silver badges66 bronze badges

12

According to documentation, the Windows security model…

does not grant administrative privileges at all
times. Even administrators run under standard privileges when they
perform non-administrative tasks that do not require elevated
privileges.

You have the Create this task with administrative privileges option in the Create new task dialog (Task Manager > File > Run new task), but there is no built-in way to effectively elevate privileges using the command line.

However, there are some third party tools (internally relying on Windows APIs) you can use to elevate privileges from the command line:

NirCmd:

  1. Download it and unzip it.
  2. nircmdc elevate cmd

windosu:

  1. Install it: npm install -g windosu (requires node.js installed)
  2. sudo cmd

answered Mar 21, 2014 at 15:28

Ricardo Stuven's user avatar

Ricardo StuvenRicardo Stuven

4,6762 gold badges35 silver badges36 bronze badges

7

I use nirsoft programs (eg nircmdc) and sysinternals (eg psexec) all the time. They are very helpful.

But if you don’t want to, or can’t, dl a 3rd party program, here’s another way, pure Windows.

Short answer: you can while elevated create a scheduled task with elevated privileges which you can then invoke later while not elevated.

Middle-length answer: while elevated create task with (but I prefer task scheduler GUI):

schtasks /create /sc once /tn cmd_elev /tr cmd /rl highest /st 00:00

Then later, no elevation needed, invoke with

schtasks /run /tn cmd_elev

Long answer: There’s a lot of fidgety details; see my blog entry «Start program WITHOUT UAC, useful at system start and in batch files (use task scheduler)»

bluish's user avatar

bluish

25.6k27 gold badges119 silver badges177 bronze badges

answered Feb 19, 2015 at 7:59

john v kumpf's user avatar

3

The following as a batch file will open an elevated command prompt with the path set to the same directory as the one from where the batch file was invoked

set OLDDIR=%CD%
powershell -Command "Start-Process cmd -ArgumentList '/K cd %OLDDIR%' -Verb RunAs "

answered Apr 14, 2017 at 0:25

statler's user avatar

statlerstatler

1,2741 gold badge15 silver badges24 bronze badges

1

While both solutions provided by Dheeraj Bhaskar work, unfortunately they will result in the UAC dialog showing up on top (z-order-wise) but not getting focused (the focused window is the caller cmd/powershell window), thus I either need to grab the mouse and click «yes», or to select the UAC window using Alt+Shift+Tab. (Tested on Win10x64 v1607 build14393.447; UAC = «[…] do not dim […]».)

The following solution is a bit awkward as it uses two files, but it preserves the correct focus order, so no extra mouse / keyboard actions are required (besides confirming the UAC dialog: Alt+Y).

  1. cmdadm.lnk (shortcut properties / Advanced… / Run as administrator = ON)

    %SystemRoot%System32cmd.exe /k "cd /d"
  2. su.bat

    @start cmdadm.lnk %cd%

Run with su.

answered Dec 3, 2016 at 0:18

Ogmios's user avatar

OgmiosOgmios

6487 silver badges12 bronze badges

3

My favorite way of doing this is using PsExec.exe from SysInternals, available at http://technet.microsoft.com/en-us/sysinternals/bb897553

.psexec.exe -accepteula -h -u "$username" -p "$password" cmd.exe

The «-h» switch is the one doing the magic:

-h If the target system is Vista or higher, has the process run with the account’s elevated token, if available.

answered Sep 7, 2014 at 14:11

David Rodriguez's user avatar

David RodriguezDavid Rodriguez

2,3921 gold badge17 silver badges15 bronze badges

4

Make the batch file save the credentials of the actual administrator account by using the /savecred switch. This will prompt for credentials the first time and then store the encrypted password in credential manager. Then for all subsequent times the batch runs it will run as the full admin but not prompt for credentials because they are stored encrypted in credential manager and the end user is unable to get the password. The following should open an elevated CMD with full administrator privileges and will only prompt for password the first time:

START c:WindowsSystem32runas.exe /user:Administrator /savecred cmd.exe

bluish's user avatar

bluish

25.6k27 gold badges119 silver badges177 bronze badges

answered May 17, 2018 at 18:32

Stefan Gadecki's user avatar

I’ve been using Elevate for awhile now.

It’s description — This utility executes a command with UAC privilege elevation. This is useful for working inside command prompts or with batch files.

I copy the bin.x86-64elevate.exe from the .zip into C:Program Fileselevate and add that path to my PATH.

Then GitBash I can run something like elevate sc stop W3SVC to turn off the IIS service.

Running the command gives me the UAC dialog, properly focused with keyboard control and upon accepting the dialog I return to my shell.

answered Jun 11, 2017 at 16:33

seangwright's user avatar

seangwrightseangwright

16.7k6 gold badges41 silver badges54 bronze badges

4

Dheeraj Bhaskar’s method with Powershell has a missing space in it, alt least for the Windows 10 incarnation of Powershell.

The command line inside his sudo.bat should be

powershell.exe -Command "Start-Process cmd "/k cd /d %cd% " -Verb RunAs"

Note the extra space after %cd%

;)Frode

answered May 14, 2019 at 9:19

Frode Severin Hatlevik's user avatar

Similar to some of the other solutions above, I created an elevate batch file which runs an elevated PowerShell window, bypassing the execution policy to enable running everything from simple commands to batch files to complex PowerShell scripts. I recommend sticking it in your C:WindowsSystem32 folder for ease of use.

The original elevate command executes its task, captures the output, closes the spawned PowerShell window and then returns, writing out the captured output to the original window.

I created two variants, elevatep and elevatex, which respectively pause and keep the PowerShell window open for more work.

https://github.com/jt-github/elevate

And in case my link ever dies, here’s the code for the original elevate batch file:

@Echo Off
REM Executes a command in an elevated PowerShell window and captures/displays output
REM Note that any file paths must be fully qualified!

REM Example: elevate myAdminCommand -myArg1 -myArg2 someValue

if "%1"=="" (
    REM If no command is passed, simply open an elevated PowerShell window.
    PowerShell -Command "& {Start-Process PowerShell.exe -Wait -Verb RunAs}"
) ELSE (
    REM Copy command+arguments (passed as a parameter) into a ps1 file
    REM Start PowerShell with Elevated access (prompting UAC confirmation)
    REM     and run the ps1 file
    REM     then close elevated window when finished
    REM Output captured results

    IF EXIST %temp%trans.txt del %temp%trans.txt
    Echo %* ^> %temp%trans.txt *^>^&1 > %temp%tmp.ps1
    Echo $error[0] ^| Add-Content %temp%trans.txt -Encoding Default >> %temp%tmp.ps1
    PowerShell -Command "& {Start-Process PowerShell.exe -Wait -ArgumentList '-ExecutionPolicy Bypass -File ""%temp%tmp.ps1""' -Verb RunAs}"
    Type %temp%trans.txt
)

answered Mar 7, 2017 at 14:38

Shadow Lynx's user avatar

..

@ECHO OFF
SETLOCAL EnableDelayedExpansion EnableExtensions
NET SESSION >nul 2>&1
IF %ERRORLEVEL% NEQ 0 GOTO ELEVATE
GOTO :EOF

:ELEVATE
SET this="%CD%"
SET this=!this:=\!

MSHTA "javascript: var shell = new ActiveXObject('shell.application'); shell.ShellExecute('CMD', '/K CD /D "!this!"', '', 'runas', 1);close();"
EXIT 1

save this script as «god.cmd» in your system32 or whatever your path is directing to….

if u open a cmd in e:mypictures and type god
it will ask you for credentials and put you back to that same place as the administrator…

answered Feb 9, 2018 at 0:40

jOte-'s user avatar

jOte-jOte-

514 bronze badges

2

There seem to be a lot of really creative solutions on this, but I found Stiegler & Gui made the most sense to me. I was looking into how I could do this, but using it in conjunction with my domain admin credential, instead of relying on the local permissions of the «current user».

This is what I came up with:

runas /noprofile /user:DomainNameUserName "powershell start cmd -v runas"

It may seem redundant, but it does prompt for my admin password, and does come up as an elevated command prompt.

answered Oct 7, 2021 at 14:18

nmeyer's user avatar

1

Here is a way to integrate with explorer.
It will popup a extra menu item when you right-click in any folder within Windows Explorer:

Windows Explorer Integration

Here are the steps:

  1. Create this key: HKEY_CLASSES_ROOTFoldershelldosherewithadmin
  2. Change its Default value to whatever you want to appear as the menu item text.
    E.g. «DOS Shell as Admin«
  3. Create another key: HKEY_CLASSES_ROOTFoldershelldosherewithadmincommand
  4. and change its default value to this:
    powershell.exe -Command "Start-Process -Verb RunAs 'cmd.exe' -Args '/k pushd "%1"'"
  5. Done. Now right-click in any folder and you will see your item there within the other items.

*we use pushd instead of cd to allow it to work in any drive. :-)

not2qubit's user avatar

not2qubit

13.3k8 gold badges89 silver badges122 bronze badges

answered Jul 18, 2020 at 21:11

rribas's user avatar

rribasrribas

4151 gold badge6 silver badges6 bronze badges

For fans of Cygwin:

cygstart -a runas cmd

answered Nov 15, 2020 at 12:22

gavenkoa's user avatar

gavenkoagavenkoa

43.6k17 gold badges243 silver badges295 bronze badges

When a CMD script needs Administrator rights and you know it, add this line to the very top of the script (right below @ECHO OFF):

NET FILE > NUL 2>&1 || POWERSHELL -ex Unrestricted -Command "Start-Process -Verb RunAs -FilePath '%ComSpec%' -ArgumentList '/c "%~fnx0" %*'" && EXIT /b

The NET FILE checks for existing Administrator rights. If there are none, PowerShell restarts the current script (with its arguments) in an elevated shell, and the non-elevated script closes.

To allow running scripts -ex Unrestricted is necessary.
-Command executes the following string.
Start-Process -Verb RunAs runs a process As Administrator:
the shell (%ComSpec%, usually C:WindowsSystem32cmd.exe) starting (/c) the current script ("%~fnx0") passing its arguments (%*).

Maybe not the exact answer to this question, but it might very well be what people need that end up here.

answered Sep 21, 2021 at 10:15

Michel de Ruiter's user avatar

Michel de RuiterMichel de Ruiter

6,7035 gold badges50 silver badges70 bronze badges

2

The quickest way by far is to:

  1. CTRL+ALT+DELETE
  2. Run TASK MANAGER
  3. Click FILE > Run New Task > type in "cmd" and tick the «Create this task with administrative privileges.» box.

Not sure if this helps but this is how I managed to do it. Doesn’t help if you need a command to run from batch but hey-ho … I needed this just because windows explorer is corrupted and needed to fix it.

This is my workaround. Hope this helps someone if not the original poster.

tomerpacific's user avatar

tomerpacific

4,38612 gold badges33 silver badges51 bronze badges

answered Aug 16, 2021 at 10:30

Gareth's user avatar

GarethGareth

591 gold badge1 silver badge6 bronze badges

1

A little late for an answer but answering anyway for latecomers like me.
I have two approaches. First one is based on little alteration to @Dheeraj Bhaskar’s answer and second one is new(that is not mentioned in any answer here).

Approach 1: Create a admin command for windows(just for the sake of flexibility).

@ECHO OFF
powershell -Command "Start-Process %1 -Verb RunAs"

Open notepad -> copy/paste above script -> save it as admin.bat in c:windows

A lot can be added in the above script to make it better but I’ve tried to keep it simple and also because I’m not an expert in batch scripting.

Now you can use admin as command to run any other command or application with elevated privileges.

To answer the original question- type admin cmd in standard cmd.

Approach 2:Using runas command. For this we need to enable the built-in Administrator account if not already enabled and set a password. This account is disabled by default on most systems.

When manufacturing PCs, you can use the built-in Administrator account to run programs and apps before a user account is created. Source

Steps to enable Administrator account-

  1. Hit Windows+R and type compmgmt.msc which will open Computer Management window.
  2. Go to System Tools -> Local Users and Groups -> Users
  3. You should see an account with name Administrator here(more info about this account can be found here).
  4. Right click on Administrator and select Properties.
  5. Check Password never expires. Uncheck Account is Disabled and everything else then click OK. This will enable administrator account on your system. Skip if already enabled.
  6. Again Right click on Administrator and click on Set Password(by default it has no password set but for runas command to work we need to set a password).
    Now windows will show you a life threatening warning which you can accept.
    OR If you want to play safe then you should login into it after enabling this account and set a password from there.

Now runas command should work-
Start a standard cmd and type-

runas /user:administrator cmd

EXTRA:
Now we can create something similar to Linux’s sudo command. Create a sudo.bat file with following script and save it in c:windows.

@ECHO OFF
powershell -Command "runas /user:administrator %1"

Now we can do sudo cmd

answered Dec 1, 2021 at 16:32

avm's user avatar

avmavm

3773 silver badges15 bronze badges

I did this for my smartctl, and it became a portable App.
I borrowed it from here.

@echo off

set location=%cd%bin
powershell -Command "Start-Process cmd -Verb RunAs -ArgumentList { '/k "TITLE Smartctl" & color 07 & pushd "%location%" & prompt $g & echo "Welcome to Smartctl cmd"' }"

prompt $g hides the long leading path.
pushd "%location%" is similar to cd /d "%location%"

  1. Saved as smartctl.cmd
  2. Create a shortcut for smartctl.cmd
  3. Copy the shortcut to C:Users#YourName#AppDataRoamingMicrosoftWindowsStartMenuPrograms
  4. Click search next to the start menu and input smartctl
  5. Right click Pin to Start

answered Dec 3, 2021 at 6:28

Missing Twins's user avatar

Just use the command:
runas /noprofile /user:administrator cmd

answered Jan 8, 2020 at 9:32

Thủy Chu's user avatar

Use:

start, run, cmd, then control+shift+enter

You’ll get UAC and then an elevated command shell.

answered Mar 28, 2021 at 2:36

Jeter-work's user avatar

Jeter-workJeter-work

7577 silver badges22 bronze badges

Install gsudo tool and use gsudo command. UAC popup appears and eventually command prompt right in the current console window will be elevated:

C:UsersSomeone>net session
System error 5 has occurred.

Access is denied.

C:UsersSomeone>gsudo
C:UsersSomeone# net session
There are no entries in the list.

The tool can be installed using various package managers (Scoop, WinGet, Chocolatey).

answered Jul 16, 2022 at 20:51

Ilya Serbis's user avatar

Ilya SerbisIlya Serbis

20.5k6 gold badges81 silver badges72 bronze badges

1

Can use a temporary environment variable to use with an elevated shortcut (

start.cmd

setx valueName_betterSpecificForEachCase %~dp0
"%~dp0ascladm.lnk"

ascladm.lnk (shortcut)

_ propertiesadvanced"run as administrator"=yes

(to make path changes you’ll need to temporarily create the env.Variable)

_ propertiestarget="%valueName_betterSpecificForEachCase%ascladm.cmd"

_ properties"start in"="%valueName_betterSpecificForEachCase%"

ascladm.cmd

setx valueName_betterSpecificForEachCase=
reg delete HKEY_CURRENT_USEREnvironment /F /V valueName_betterSpecificForEachCase
"%~dp0fileName_targetedCmd.cmd"

) (targetedCmd gets executed in elevated cmd window)

Although it is 3 files ,you can place everything (including targetedCmd) in some subfolder (do not forget to add the folderName to the patches) and rename «start.cmd» to targeted’s one name

For me it looks like most native way of doing this ,whilst cmd doesn’t have the needed command

Jee Mok's user avatar

Jee Mok

5,8498 gold badges46 silver badges75 bronze badges

answered Jul 25, 2018 at 23:28

ilia's user avatar

iliailia

291 silver badge5 bronze badges

1

You can use the following syntax, I had the same question and did not think a script should be needed.

runas /profile /user:domainusername cmd

This worked for me, it may be different on your network.

answered Nov 29, 2019 at 15:28

Sean Golash's user avatar

I did it easily by using this following command in cmd

runas /netonly /user:AdministratorAdministrator cmd

after typing this command, you have to enter your Administrator password(if you don’t know your Administrator password leave it blank and press Enter or type something, worked for me)..

answered Aug 16, 2018 at 7:18

Harish Regada's user avatar

2

Press the Windows + X key and you can now select the Powershell or Command Prompt with admin rights. Works if you are the admin. The function can be unusable if the system is not yours.

Trooper Z's user avatar

Trooper Z

1,58013 silver badges31 bronze badges

answered Feb 25, 2019 at 14:11

Tom's user avatar

I’ve created this tool in .Net 4.8 ExecElevated.exe, 13KB (VS 2022 source project) it will execute an application with an elevated token (in admin mode).
But you will get an UAC dialog to confirm! (maybe not if UAC has been disabled, haven’t tested it).

And the account calling the tool must also have admin. rights of course.

Example of use:

ExecuteElevated.exe "C:Utilityregjump.exe HKCUSoftwareClasses.pdf"

answered Nov 14, 2014 at 23:55

MrCalvin's user avatar

MrCalvinMrCalvin

1,5531 gold badge16 silver badges23 bronze badges

7

I used runas /user:domainuser@domain cmd which opened an elevated prompt successfully.

answered Mar 10, 2014 at 23:02

JasonC's user avatar

JasonCJasonC

191 silver badge7 bronze badges

1

There are several ways to open an elevated cmd, but only your method works from the standard command prompt. You just need to put user not username:

runas /user:machinenameadminuser cmd

See relevant help from Microsoft community.

answered Sep 30, 2013 at 16:05

Matt's user avatar

MattMatt

1,7125 gold badges20 silver badges32 bronze badges

1

In this tutorial you’ll find all the available ways to run CMD (Command Prompt) as Administrator in Windows 10 or Windows 11 OS. As you may know, opening the Command Prompt as Administrator, allows you to execute commands that requires Administrative privileges.

There are several ways to run cmd as administrator on Windows 10 and in this guide will show you all of them.

How to Run Command Prompt as Administrator in Windows 11/10.

Method 1. Open CMD as Administrator from Search.

Any easy way to run cmd as administrator in Windows 10, is to start command prompt as administrator, using the search menu:

1. On the Search image box, type cmd

2. Now, perform one of the following actions:

a. Right-Click at Command Prompt and select Run as Administrator.

Run CMD as Administrator in Windows 10

b. Select Run as Administrator

Run Command Prompt as Administrator

Method 2. Run Command as Administrator Using the RUN box.

One of the fastest methods to open an administrator command prompt on Windows 10 is the following:

1. Simultaneously press the Win image + R keys to open the run command box.
2. Type cmd and press CTRL+SHIFT+ENTER keys to open Command Prompt as Administrator.

open cmd as admin

Method 3. Run CMD as Administrator from Power User menu.

Another method to open command prompt as admin in Windows 10, is by using the Power User menu.

1. Press the Win image + X keys, or right-click at the Start image menu.

2. Click Command Prompt (Admin) to run cmd as administrator. *

run Command Prompt as Admin

* Note: Note if the Command Prompt (admin) option is missing, then navigate to Start > Settings > Personalization > Taskbar and set to OFF the «Replace Command Prompt with Windows PowerShell in menu when I right-click the start button or press Windows key +X» switch.

Enable Command Prompt on Right-Click Power User Menus

Method 4. Run Command Prompt As Administrator from the Start menu.

To open command prompt with elevated rights on Windows 10 from the Start menu:

1. Click the Start menu and expand the Windows System folder/menu.
2. Right-click at Command Prompt and select More > Run as administrator.

Run Command Prompt as Admin Start menu

Method 5. Open CMD as Admin using Task Manager.

The final method to launch command prompt as Administrator on Windows, is by using Task Manager:

1. Press CTRL + SHIFT + ESCAPE to open Task Manager.
2. Click the File menu and select Run new task.

Task Manager - Run New Task

3. Type cmd and check the «Create this task with administrative privileges» checkbox. Finally press Enter or click OK.

cmd task

That’s it! Let me know if this guide has helped you by leaving your comment about your experience. Please like and share this guide to help others.

If this article was useful for you, please consider supporting us by making a donation. Even $1 can a make a huge difference for us in our effort to continue to help others while keeping this site free:

If you want to stay constantly protected from malware threats, existing and future ones, we recommend that you install Malwarebytes Anti-Malware PRO by clicking below (we
do earn a commision from sales generated from this link, but at no additional cost to you. We have experience with this software and we recommend it because it is helpful and useful):

Full household PC Protection — Protect up to 3 PCs with NEW Malwarebytes Anti-Malware Premium!

A small tip on how to run your command prompt as an administrator or in other words, open an elevated command prompt, in Windows 11/10/8/7. We have seen how to launch Command Prompt, and carry out many tasks. But some tasks required elevated privileges to be run. In such cases, you have to open an elevated command prompt window. So let us see how to launch, run or open Command Prompt as an administrator or an elevated CMD with administrative privileges & rights in Windows 11/10/8/7.

To run Command Prompt as administrator in Windows 11/10, follow these steps:

  1. Search for cmd in the Taskbar search box.
  2. Make sure the Command Prompt result is selected.
  3. Click on the Run as administrator option.
  4. Click the Yes button in the UAC prompt.

To learn more about these steps, continue reading.

At first, you need to search for cmd in the Taskbar search box and ensure that the Command Prompt result is selected or highlighted.

How to run Command Prompt as Administrator in Windows 11/10

If so, click the Run as administrator option. If your computer displays the UAC prompt, click the Yes option to find Command Prompt as administrator.

However, if you are using Windows 10 or Windows 8, you may not have to follow this aforementioned method. In Windows 10/8, you can open elevated Command Prompt from the Win+X menu.

In Windows 10 and Windows 8, follow these steps:

Take the cursor to the bottom left corner and right-click to open the WinX menu. Select Command Prompt (Admin) to open an elevated command prompt.

So you see, things have been made easier in Windows 10/8.1.

In Windows 7, follow these steps:

  • Type cmd in Start search.
  • In the results, you will see ‘cmd‘.
  • Right-click on it and from the context menu select Run as Administrator.

run cmd as admin

TIP: This post will help you if you can’t run Command Prompt as administrator.

Open Elevated Command Prompt using the System32 folder

open elevated command prompt using system32

The System32 folder contains the storage location of the Windows Command Processor (cmd.exe) application. You can access that location and then open an elevated Command Prompt window. Here are the steps:

  1. Press Win+E hotkey to open the File Explorer
  2. Go to C:WindowsSystem32
  3. Under the System32 folder, look for the cmd.exe file
  4. Right-click on the cmd.exe file
  5. Click on the Run as administrator option.

In the UAC prompt, you need to use the Yes button, and then an elevated Command Prompt window will be in front of you.

Run Command Prompt as an administrator using the Run Command box

You can also use the Run Command box to open Command Prompt window as an administrator on your Windows 11/10 computer. For this, the steps are as follows:

  1. Use Win+R hotkey. This will open the Run Command box
  2. Type cmd or cmd.exe in the text field
  3. Press Ctrl+Shift+Enter hotkey.

If a UAC prompt appears, press the Yes button, and the Command Prompt window will open as an administrator.

Open Command Prompt as an administrator using PowerShell

Windows PowerShell can also help you open a Command Prompt window as an administrator on a Windows 11/10 PC. The steps are mentioned below:

  1. Open Windows PowerShell using the Search box or another way you like
  2. In the PowerShell window, enter and execute the following command:
start-process cmd -verb runas

This will open the UAC prompt box in which you can click on the Yes button. Finally, an elevated Command Prompt window will be there.

Other ways to open an elevated command prompt:

There are more other ways to open an elevated Command Prompt in Windows 11/10. Some of the ways are:

  1. Press Ctrl+Shift+Esc to open the Task Manager. Click on File menu > Run new task. To open a command prompt window, type cmd. Remember to check the Create this task with administrative privileges check-box. Then hit Enter.
  2. You can also open an elevated Command Prompt from the Task Manager using CTRL key.
  3. Or then simply open the Start Menu or Start Screen and start typing the command line. Next, hold the Shift and Ctrl keys, and then hit Enter to open the command line in an elevated command prompt.
  4. Open an elevated command prompt using CMD
  5. Run Commands from Windows Start Search Box as an Administrator
  6. How to always run Command Prompt as Administrator
  7. Run commands from Explorer address bar.

How do I get Command Prompt in Windows 11/10 as administrator?

There are a lot of ways using which you can open Command Prompt as an administrator in Windows 10 as well as Windows 11 OS. You can use the Search box, Win+X menu, Windows PowerShell, Run Command box, and other options to open an elevated Command Prompt. All such options are covered in this post above. Check them.

How do I force Command Prompt to run as administrator?

You can use the keyboard shortcut to force Command Prompt to run as administrator. For that, you need to search for cmd in the Taskbar search box and press the Ctrl+Shit+Enter button together.

How do I open Command Prompt in Windows 11?

Although Microsoft removed Command Prompt from the Win+X menu in Windows 11, you can use the Taskbar search box to open Command Prompt on your computer. You need to search fox cmd and hit the Enter button. It will open Command Prompt on your PC. Alternatively, you can open Windows Terminal to perform the same job.

How do I run cmd as administrator in standard user?

To run cmd or Command Prompt as administrator in Standard user, you need to follow the steps mentioned above. In other words, you need to search for cmd in the Taskbar search box, click the Run as administrator option, and click the Yes option.

Now see how to open an elevated PowerShell prompt in Windows 11/10.

You are here:
Home » Windows 10 » 8 Ways To Open Command Prompt As Administrator In Windows 10

The majority of Windows users will never need to open Command Prompt as an administrator or elevated Command Prompt as most of the commands can be executed without the elevated Command Prompt.

That said, some tasks can only be performed from Command Prompt running with administrator rights, and you get “You may not have permission to perform this operation” or “Access is denied” error when you try to execute certain commands without admin rights.

In Windows 10, there are multiple ways to open Command Prompt as an administrator or run elevated Command Prompt. You can follow one of the below-mentioned methods to launch Command Prompt as an administrator in Windows 10.

open command prompt as administrator in Windows 10

NOTE: If you’re wondering how to know that the Command Prompt has been launched as an administrator, it’s easy. When the Command Prompt is launched with admin rights, the “Administrator” text will appear on the title bar (see the picture above) of the Command Prompt window.

Anyways, below are the methods to open Command Prompt as an administrator in Windows 10.

Method 1 of 8

Use shortcut keys to open elevated Command Prompt quickly

This is probably the easiest and fastest method out there to open Command Prompt as an administrator.

Step 1: Press the Windows logo key on the keyboard or click/tap the Windows logo button on the bottom-left corner of the screen to open the Start.

Step 2: Type CMD in the Start/taskbar search box (search box is automatically selected when you open Start) or in the Run command box, and then simultaneously press Ctrl+Shift+Enter keys.

Step 3: Click the Yes button when you get the User Account Control dialog box. That’s it!

Note: If you are using a non-admin account, you’ll be asked to enter the admin account password to open the Command Prompt as an administrator.

Method 2 of 8

Another easy way to open Command Prompt as admin in Windows 10

Step 1: Right-click on the Start menu (or use Windows logo + X keys) and then click the Command Prompt (Admin) option.

open command prompt as administrator in Windows 10 pic04

NOTE: If you cannot see Command Prompt entry, navigate to Settings > Personalization > Taskbar and then turn off Replace Command Prompt with Windows PowerShell in the menu when I right-click the Start button or press Windows key + X option.

open command prompt as administrator in Windows 10 pic004

Step 2: Click the Yes button when you get the User Account Control screen to open Command Prompt as admin.

Method 3 of 8

Use search to open elevated Prompt from Start

Step 1: Open the Start by either clicking the Windows logo key on the bottom left corner of the screen or by pressing the Windows logo key on the keyboard.

Step 2: Type Command Prompt or CMD in the search box to see Command Prompt entry in the result, right-click on the Command Prompt and then click Run as administrator.

open command prompt as administrator in Windows 10

Method 4 of 8

Open admin Command Prompt from Start menu

Step 1: Open the Start by clicking the Windows logo button on the extreme left on the taskbar (bottom left corner of the screen) or by pressing the Windows logo key on the keyboard.

Step 2: In the Start menu, scroll the apps list to see the Windows System folder, expand the Windows System folder to reveal the Command Prompt entry, right-click on Command Prompt entry, click More and then click or tap Run as administrator.

open command prompt as administrator in Windows 10 pic03

Click or tap the Yes button when you see the User Account Control box or enter the password of the admin account if you’re using the Admin account.

Method 5 of 8

CMD as administrator from File Explorer

Step 1: Open the Run command dialog box by simultaneously pressing the Windows logo and R keys.

Step 2: In the Run command box, type %windir%System32 and then press Enter key to open the System32 folder.

Administrator Command Prompt method 5

Step 3: Locate the file named cmd.exe, right-click on the same, and then click the Run as administrator option.

Administrator Command Prompt method 51

Click the Yes button or enter the admin account password when asked to do so.

Method 6 0f 8

Step 1: Open the Run command box by simultaneously pressing the Windows logo and R keys (Windows + R).

Step 2: In the Run command box, type CMD and then simultaneously press Ctrl + Shift + Enter keys to open Command Prompt as administrator. Click on the Yes button when you get the UAC prompt.

Method 7 of 8

Open Command Prompt from Task Manager

This method is useful and works only if you signed in to an admin account.

Step 1: Open Task Manager. To do so, you either right-click on the Start button or taskbar and then click Task Manager. Task Manager can also be launched using Ctrl+ Shift+Esc hotkey.

open command prompt as administrator in Windows 10

open command prompt as administrator

If the Task Manager is launched with fewer details is launched, click More details to open the full version.

Administrator Command Prompt method 62

Step 2: Once the Task Manager is launched, click the File menu.

Step 3: Now, hold down the Ctrl key and then click Run new task open Command Prompt as administrator. In this method, you’ll not see the User Account Control dialog box.

Administrator Command Prompt method 63

That’s it!

Method 8 of 8

Open Command Prompt window here as administrator

UPDATE: This method no longer works.

As you likely know, when we hold down the Shift key and right-click on a folder, Open Command Prompt window here option appears in the context menu. If you want to open the Command Prompt as an administrator from a folder, you can use this method.

Step 1: Click the File menu, hover the mouse cursor over Open Command Prompt to see Open Command Prompt as administrator option. Click on the same option to run Command Prompt as administrator.

Administrator Command Prompt method 7

That’s all we know. If there is an easier way to open Command Prompt as an administrator, do let us know by leaving comments. You can also let us know if any of the methods mentioned above are not working for you.

Tip: You can configure Windows 10 always to open Command Prompt as administrator. Please go through our how to always run Command Prompt as an administrator guide for detailed instructions.

This basic guide details 8 ways how to run a command prompt as an administrator on Windows.

Contents

  1. Via List of programs
  2. Via Quick links menu
  3. Via Task Manager (quick)
  4. Via Task Manager (standard)
  5. Via Run menu
  6. Via Windows 10 Search
  7. From Windows folder
  8. Via PowerShell

💡 On Windows 10, 8.1, 8 – instead of the command prompt, you can use PowerShell, which supports all cmd.exe commands.

Article in other languages:
🇪🇸 – Cómo ejecutar el Símbolo del sistema como administrador
🇷🇺 – Как запустить командную строку от администратора
🇫🇷 – Comment exécuter Invite de commande en tant qu’administrateur
🇩🇪 – So führen Sie die Eingabeaufforderung als Administrator aus
🇳🇱 – Hoe de opdrachtprompt als administrator uitvoeren

Via List of programs

Run the command prompt as admin from the list of standard Windows programs.

💡 Suitable: Windows 10, Windows 8.

  1. Open the Start menu (Ctrl + ESC);
  2. Open the Windows System;
  3. Right-click Command PromptMoreRun as administrator.

How to run Command Prompt as admin Windows

Run the Command prompt as administrator from the Start menu

We enable the ability to run the command prompt as administrator on the menu on the Start button.

💡 Suitable: Windows 10, Windows 8.

  1. Right-click on the Taskbar, select – Taskbar settings;
  2. Disable the Replace Command Prompt with Windows PowerShell in the menu…;
  3. Right-click on the Start button (Windows + X), select Command Prompt (Admin).

Run Command Prompt as admin via the Quick links menu

Run the Command prompt as administrator via Quick links

Via Task Manager (quick)

Running a Command Prompt as administrator via the Windows Task Manager (quick way).

💡 Suitable: Windows 10, Windows 8, Windows 7.

  1. Call Task Manager (Ctrl+Shift+ESC);
  2. Click on the File;
  3. Hold down the Ctrl key and click Run New Task.

Run Command Prompt as admin via Task Manager (quick)

Run the Command prompt as administrator via Task manager

Via Task Manager (standard)

Running the Command Prompt as administrator via the Windows Task Manager (standard way).

💡 Suitable: Windows 10, Windows 8, Windows 7.

  1. Call Task Manager (Ctrl+Shift+ESC);
  2. Click on the File;
  3. Click Run New Task;
  4. Select the Create this task with administrative privileges check box;
  5. Type cmd and click OK.

Run Command Prompt as admin via Task Manager (standard)

💡 Suitable: Windows 10, 8.1, 7.

Open the Run menu.

  1. Press the Windows+R key combination (or right-click on the Start button, select Run);
  2. Enter the cmd command;
  3. Press the keyboard shortcut Ctrl+Shift+Enter.

How to run command prompt via Run menu

Via Windows 10 Search

Run the Command Prompt as administrator via Windows 10 Search.

💡 Suitable: Windows 10.

  1. Press the combination Windows+S (or right-click the Start button, select Search);
  2. In the search bar write the command prompt (the result will be displayed earlier than you type completely);
  3. In the right part of the window, select Run as administrator.

Run Command Prompt via Windows 10 Search

From Windows folder

Running cmd.exe from the utility location folder is another way to run the command prompt as administrator.

💡 Suitable: for all versions of Windows.

  1. Open the System32 folder to the Windows folder (usually C:WindowsSystem32);
  2. Right-click on the cmd file and select Run as administrator.

Starting a command prompt from the System32 system folder

Via PowerShell

Another way to run Command Prompt as administrator is from PowerShell.

Run the command in the PowerShell console:

start-process cmd -verb runas

How to Run Command Prompt as administrator via PowerShell


🟢 This article discussed how to run Command Prompt as admin Windows. I hope you were able to run the Command Prompt as as administrator with the chosen method. However, if you encounter any problems when starting the command prompt, feel free to write in the comments. I will try to help.


Download Article

Quick guide to open the Command Prompt as an admin


Download Article

This wikiHow will show you how to open the Windows Command Prompt (also called the terminal window) as an administrator. This can be done easily if you’re logged in to a user account that has administrator privileges. Running the Command Prompt as an administrator gives you access to more commands and permissions.

Things You Should Know

  • Press the Windows Key + S to open the search bar.
  • Search for cmd and right-click “Command Prompt” in the results.
  • Select Run as administrator.
  1. Image titled Run Command Prompt As an Administrator on Windows Step 1

    1

    Press the Windows Key (

    Image titled Windowsstart.png

    ) + S at the same time. This opens Windows search.

    • If you’re not logged in as an administrator, check out our guide on how to log in as an admin in Windows.
  2. Image titled Run Command Prompt As an Administrator on Windows Step 2

    2

    Type cmd in the search bar.

    Advertisement

  3. Image titled Run Command Prompt As an Administrator on Windows Step 3

    3

    Right-click Command Prompt

    Image titled Windowscmd1.png

    . It’s the option in the results list with a black terminal window icon.

  4. Image titled Run Command Prompt As an Administrator on Windows Step 4

    4

    Click «Run as administrator». This is the top option in the right-click menu.

    • Click Yes when prompted, “Do you want to allow this app to make changes to this device?” This will open a window called “Administrator: Command Prompt”.
    • You’re done! The Command Prompt has been opened.
  5. Advertisement

Add New Question

  • Question

    Is there a command to activate admin cmd while already in normal cmd?

    Arrogance

    You can launch a new elevated Command Prompt window with «powerShell -Command Start-Process cmd -verb RunAs». You cannot launch a new elevated prompt in the same window.

  • Question

    When I click manage account on my admin account, it says manage another account and change password. What is going on?

    Community Answer

    Press the Windows key (Image titled Windowsstart.png) + S at the same time. This opens Windows search.

  • Question

    How do I undo run as administrator?

    Liam Townsley

    Liam Townsley

    Community Answer

    Restart your command prompt and it will no longer be an administrator terminal.

See more answers

Ask a Question

200 characters left

Include your email address to get a message when this question is answered.

Submit

Advertisement

  • You can type help to see a list of various commands and what they do.

  • You can type /? after a command to see the help information about that command.

Advertisement

  • Be careful when running commands when running Command Prompt as an administrator. You can do permanent damage to your computer if you run the wrong command.

  • Don’t run any random command that you find on the internet. Some people will troll others by saying that you should run a command to fix a problem, but the command will actually damage your computer.

    • Some commands that you should avoid running are «del», «rd», or «format», unless you know what you are doing. This list is not exhaustive though, and other commands can still be dangerous.

Advertisement

Things You’ll Need

  • Administrator permissions

About This Article

Article SummaryX

1. Press the Windows Key + S.
2. Type cmd.
3. Right-click Command Prompt.
4. Click Run as administrator.

Did this summary help you?

Thanks to all authors for creating a page that has been read 146,904 times.

Is this article up to date?

  • MiniTool

  • MiniTool News Center

  • How Can You Run Command Prompt as Administrator on Windows?

By Stella | Follow |
Last Updated November 25, 2020

google search

In some certain situations, you need to run Command Prompt as Administrator and then you can use some command line that requires administrative privileges. But, do you know how to run CMD as administrator on Windows 10? In this post, MiniTool Solution will show you 3 easy methods to do this job.

Why Do You Need to Run CMD as Administrator?

In most instances, you just use the Command Prompt as a regular user. This can meet your basic requirements. In some other cases, you need to run CMD as administrator so as to run command line that needs administrative privileges.

You can use different ways to open the Command Prompt on your computer. Accordingly, you can use numerous ways to run command prompt as administrator.

In the next part, we will walk you through three different guides on the run as administrator command line topic. You can use the one you prefer to use to perform the Windows 10 command prompt admin.

How to Run Command Prompt as Administrator?

Method 1: Use the Power Users (Windows+X) Menu

Windows 10 has a Power Users menu that contains many options that allow you to quickly access some certain utilities. Command Prompt (Admin) is included in it.

To do this job, you need to follow these steps:

  1. Press the Windows key and X key at the same time to open the Power Users menu.
  2. Select the Command Prompt (Admin) option from the menu to run Command Prompt as admin.

select Command Prompt (Admin)

You will see the Administrator: Command Prompt window as follows:

Administrator: Command Prompt

Then, you can type in the command and run it whether it requires administrative privileges or not.

Method 2: Use the Start Menu

The second way to run Command Prompt as administrator is to use the Start Menu. It is very simple to operate. You can follow these steps to do the job:

  1. Press the Start/Windows button on the lower-left corner of your computer.
  2. Type command prompt into the search box.
  3. Right-click on the first search result and select Run as administrator.

select Run as administrator

After these three simple steps, you can also see the Command Prompt Administrator interface.

Method 3: Use the Run Box

Some of you prefer to use the Run box to open applications on the computer. In this situation, you can run CMD as administrator via the Run box like this:

1. Press the Windows key and the R key at the same time to open Run.

2. Type cmd into the Run box.

type cmd into the run box

3. Press Ctrl+Shift+Enter at the same time to run the command as an administrator.

Now, this is the end of these three methods to run CMD as administrator. You can just select one way according to your own requirements.

After running Command Prompt as Administrator on Windows, you can then run certain command lines to solve some issues like mark the offline disk online to fix Error code 0xc000000e, check hard disk drive using CHKDSK, and more.

We hope this post can completely solve your issue.

About The Author

Stella

Position: Columnist

Stella has been working in MiniTool Software as an English Editor for more than 4 years. Her articles mainly cover the fields of data recovery including storage media data recovery and phone data recovery, YouTube videos download, partition management, and video conversions.

Using the instructions here you will have the ability to open Command Prompt as administrator in Windows 10 from Start, Search, Run, taskmgr, PowerShell, and more. This application allows running commands that help you fix multiple issues, change settings, and access different files. When you stuck in anything on Windows 10 the first tool you remember is CMD. Administrative authority makes you capable to run a task in elevated mode.

We already discussed How to Launch Elevated Command Prompt on Windows 10 but now some additional ways are available for the same. So here we have come with a collection of all methods to open cmd with admin rights.

Here are 12 Ways to Open Command Prompt as Administrator in Windows 10 –

1] Quickest and easiest way to run cmd as admin

Step-1: Click on the Start icon.

Step-2: Type cmd.

Step-3: Press ctrl+shift+enter on keyboard.

Open Command Prompt as Administrator

Step-4: Once User Account Control (UAC) dialog appears, select Yes.

UAC dialog when open command prompt as administrator

2] Open command prompt as administrator from Run dialog

  1. Press Win+R and let the Run dialog box appear.
  2. Write down either cmd or cmd.exe in the empty text field onward to Open.
  3. Press ctrl, shift, and enter simultaneously.

cmd in run dialog box

  1. Click Yes when a UAC dialog prompts to seek permission.

3] Take the help of Windows search bar

  1. Press Windows and S keys.
  2. Type “cmd”
  3. Click – Run as administrator.

Open Command Prompt as Administrator in Windows 10 from start search

  1. A UAC will prompt up for authentication; choose Yes.

4] Open Command Prompt as Administrator in Windows 10 Via Win+X menu

In the recent versions of Windows 10, you notice rather Windows PowerShell (Admin) in the Power user menu (Win+X). But for launching easily, you can replace it with Command Prompt (Admin) via a small tweak in Settings. This will help you to open cmd with administrative privilege in only 2 clicks. Here’s how –

  1. Open Windows Settings  (by pressing Win and I).
  2. Select Personalization.

Personalization on Windows settings

  1. Select Taskbar from the left-pane and then shift to the right.
  2. Toggle on the option – “Replace Command Prompt with Windows PowerShell in the menu when I right-click the Start button or press Windows Key+X”.

Replace Command Prompt with Windows PowerShell in the menu when I right-click the Start button or press Windows Key+X

  1. From now onward, whenever you will open the Power user menu, you will view Command Prompt (Admin) in the list.
  2. Simply press Win+X and choose the same.

Open Command Prompt as Administrator in Windows 10 by switching from powershell

5] Open command prompt as administrator by means of Task Manager

Important – Before proceeding forward, make sure that you have signed in as administrator.

  1. Right-click on the Taskbar and select Task Manager or directly press “Ctrl+Alt+Esc”.
  2. From the menu bar, click on File option.
  3. Press and hold the Ctrl key and at the same time click Run new task.

Open Command Prompt as Administrator in Windows 10 using task manager

  1. It will right away open cmd as admin.

6] Again using Task Manager

  1. Open Task Manager using the method given in the previous way.
  2. Click on File from the uppermost menu bar and choose Run new task.
  3. Type either cmd.exe or cmd the provided space and check the box for “Create this task with administrative privileges”.
  4. Click – OK.

Open Command Prompt as Administrator in Windows 10 using run new task

7] Through Start menu

  1. Press Windows key to bring up the Start menu
  2. Click on # from the top.

hash on Start menu

  1. Select W alphabet from the list.

W alphabet on Start menu

  1. Click Windows System from here and to expand its options.
  2. Right-click on Command Prompt, move the cursor over “More”
  3. Then choose – “Run as administrator”.

Open Command Prompt as Administrator in Windows 10 from start

  1. When you see a User Account Control popup, click the Yes to give consent.

8] Switch PowerShell to Command Prompt

  1. Press “Win+X” hotkey and select “Windows PowerShell (Admin)” from the Power user menu.

PowerShell on on Win+X menu

  1. When the User Account Control shows up in the display, click the Yes button to allow it.
  2. In the “Administrator: Windows PowerShell”, type cmd after PS C:WINDOWSsystem32> and hit the Enter key.

Open Command Prompt as Administrator in Windows 10 by switching from powershell

  1. This will immediately switch the PowerShell utility to Command prompt.

9] Open Command Prompt as Administrator in Windows 10 From System32 Directory

  1. Press – Win+E.
  2. Select This PC in Quick access and then Perform a double click on “(C:)” (we assume that this is your system drive).

Local Disk C on this PC

  1. Double click –  Windows folder.

Windows folder in c drive

  1. From the next window, locate System32 and double-click on the same to enter it.

System32 directory in windows folder

  1. Once this directory appears, find cmd.exe.
  2. Right click on the same and opt Run as administrator from the list.

Open Command Prompt as Administrator in Windows 10 from System32 directory

  1. Finally, hit the Yes button once the UAC arrives.
  2. Alternatively, to get access to the location you may copy-paste “C:WindowsSystem32” into the Run dialog box and hit Enter.

10] Via Run command

  1. Press Win+R.
  2. Paste C:WindowsSystem32cmd.exe in Run dialog
  3. Hit  – ‘ctrl+shift+enter’.

cmd path in run dialog box

  1. Choose Yes when User account control prompt appears.

11] Create Desktop shortcut

  1. Right-click on the desktop.
  2. and move cursor on New and select Shortcut.

right click desktop new shortcut

  1. A wizard entitled Create Shortcut will show up.
  2. Copy C:WindowsSystem32cmd.exe paste into the given area
  3. Click Next.

cmd location in shortcut wizard

  1. Provide a name for this shortcut.
  2. Click on Finish.

shortcut name of command prompt

  1. You will notice a new shortcut for the “CMD” on the desktop. Right-click on the same and select Properties.

properties of cmd shortcut

  1. In the Shortcut tab, move down to the bottom and click the Advanced button.

Advanced on properties of cmd shortcut

  1. Mark – Run as administrator
  2. Hit the – OK.

run as administrator on advanced properties

  1. Finally, click on Apply and thereafter OK button to save the changes.

Open Command Prompt as Administrator in Windows 10 via shortcut

  1. In future, whenever you need to open command prompt as administrator, just double-click on the shortcut.

12] Assign a shortcut key to open cmd as admin

  1. Follow the previous method to create a shortcut key of Command Prompt and give it administrative authority.
  2. Right-click on the desktop shortcut and select – Properties.
  3. Go to Shortcut key area and click on the box located beside it.
  4. Now, press your preferred key from the keyboard. When you will type C and the system automatically generated a shortcut key Ctrl+Alt+C.
  5. Lastly, click on Apply and then OK to make the changes effective.

Open Command Prompt as Administrator in Windows 10 using run new task

  1. To open cmd as admin, you just require hitting the shortcut key you just created.

Methods:
1] Quickest and easiest way to run cmd as admin
2] From Run dialog
3] Take the help of Windows search bar
4] Via Win+X menu
5] By means of Task Manager
6] Again using Task Manager
7] Through Start menu
8] Switch PowerShell to Command Prompt
9] From System32 Directory
10] Via Run command
11] Create Desktop shortcut
12] Assign a shortcut key

That’s all!!

Понравилась статья? Поделить с друзьями:
  • Windows fundamentals for legacy pcs key
  • Windows found that this file is potentially harmful
  • Windows found errors on this drive that need to be repaired
  • Windows forms событие при закрытии формы
  • Windows forms скачать для visual studio code