Windows CMD Admin: Run Command Prompt as Administrator
In this article
To run Command Prompt as administrator in Windows, click Start, type cmd, right-click Command Prompt in the results, and choose Run as administrator. Confirm the User Account Control (UAC) prompt with Yes. The window title will then show Administrator: Command Prompt, and commands that need elevated rights will work. You can also press Windows + X and pick Terminal (Admin) or Windows PowerShell (Admin) on newer builds, then type cmd inside that elevated window.
What You'll Need
- A Windows 10 or Windows 11 PC (steps are written for desktop Windows; labels can differ slightly by version, edition or region).
- An account that is a local administrator, or the password for one. Standard accounts cannot elevate without administrator credentials.
- Knowledge of the exact command you intend to run. Elevated Command Prompt can change system files and settings, so only run commands you understand.
Step-by-Step
- Open the Start menu search. Click the Start button or press the Windows key, then type
cmd. The search box is the fastest route on both Windows 10 and Windows 11. - Right-click the result. In the search results, right-click Command Prompt (Windows 10) or Command Prompt under the best-match list (Windows 11). If you only see Terminal, right-click that instead and choose Run as administrator; you can type
cmdin the elevated terminal afterwards. - Choose Run as administrator. Click Run as administrator in the context menu. If the option is missing or greyed out, your account is not an administrator; sign in with an admin account or ask an administrator to enter credentials at the UAC prompt.
- Approve the UAC prompt. A User Account Control dialog appears asking whether to allow the app to make changes. Click Yes. On a standard account, you will instead be asked for an administrator's username and password.
- Confirm elevation. The Command Prompt window opens with the title Administrator: Command Prompt. That title is your proof that the session is elevated; if it just says Command Prompt, the window is not running as administrator.
- Run your command. Type the command at the prompt and press Enter. For example,
ipconfig /flushdnsclears the DNS resolver cache, andsfc /scannowscans and repairs protected system files. Read the output before closing the window; some commands print errors that are easy to miss. - Close the window when done. Type
exitand press Enter, or click the X. Closing an elevated window ends that elevated session; you will need to repeat the steps next time.
Common Mistakes
- Assuming a normal window is elevated. Opening Command Prompt from Start without right-clicking gives a standard window. Check the title bar for the word Administrator before running anything that needs elevation.
- Running unknown commands from the internet. Elevated Command Prompt can delete files, change boot settings and alter services. Copy commands only from sources you trust, and read what each command does first.
- Using the wrong shell. Some instructions are written for PowerShell or Terminal. Typing PowerShell cmdlets into Command Prompt will fail with "not recognized" errors; match the shell to the instructions.
- Ignoring UAC. Clicking No or closing the UAC prompt cancels elevation. There is no way to bypass UAC; you must approve it or supply admin credentials.
- Leaving the window open. An elevated window stays elevated until closed. Close it when finished so no one else can use that session.
Tips
- Use Windows + X. The power-user menu (press Windows + X) includes Terminal (Admin) or Windows PowerShell (Admin) depending on version. Type
cmdin the elevated window to get an elevated Command Prompt without a second UAC prompt. - Pin it for later. After opening an elevated Command Prompt, right-click its taskbar icon and choose Pin to taskbar. The pinned shortcut still triggers UAC each time, which is a useful safety check.
- Copy and paste carefully. Right-click inside the window to paste. Pasting long commands from web pages can include hidden line breaks; run them one line at a time.
- Check before you run. Use
whereto confirm a tool exists, or read a command's help withcommand /?before executing it.
Troubleshooting
If the steps above do not work, try these in order, simplest first:
- Restart the PC. A pending update or a stuck UAC service can block elevation. Restart and try again.
- Check your account type. Open Settings > Accounts and look for the account type. If it says Standard user, you need an administrator's credentials at the UAC prompt; you cannot make yourself an administrator without one.
- Try the Windows + X menu. If the Start menu search result has no Run as administrator option, use Windows + X and pick the admin terminal entry, then type
cmd. - Sign out and back in. Group policy or account changes sometimes only apply after a sign-out. Sign out, sign in, and retry.
- Check for malware or policy restrictions. If UAC prompts never appear or elevation is blocked entirely, run a full scan with Microsoft Defender and check with your organization's IT if the PC is managed. Do not disable UAC as a workaround; it protects the whole system.
Frequently Asked Questions
How do I know Command Prompt is running as administrator?
The window title bar shows Administrator: Command Prompt. If it only says Command Prompt, the window is not elevated.
Can I open an elevated Command Prompt without UAC?
No. UAC is a core Windows security feature and cannot be bypassed. You either approve the prompt or provide administrator credentials.
What is the difference between Command Prompt and PowerShell?
Both are command-line shells. Command Prompt runs classic commands like ipconfig and sfc; PowerShell runs those plus its own cmdlets. Some instructions only work in one of them, so match the shell to the guide.
Why is Run as administrator missing from the right-click menu?
Usually because your account is a standard user, or because you right-clicked a shortcut that does not support elevation. Use the Start menu search result or the Windows + X menu instead.
Does closing the window undo my changes?
No. Commands take effect immediately and persist after the window closes. Closing the window only ends the elevated session.
Is it safe to leave an elevated Command Prompt open?
It is safer to close it when finished. Anyone with access to that window can run elevated commands without another UAC prompt.