If you keep seeing “System error 5 has occurred, Access is denied” repeatedly while running commands in Command Prompt or Windows PowerShell, it’s likely that the console lacks the rights needed to execute them. For example, commands involving administrative functions (such as “net user”) or advanced troubleshooting require enhanced privileges or won’t work.

To fix “System error 5” in Microsoft Windows, you must run Command Prompt and Windows PowerShell as an administrator. The instructions below will walk you through multiple ways to open both command-line interpreters with elevated rights.

Table of Contents

    Run Command Prompt and Windows PowerShell as Administrator

    It’s impossible to run commands in Command Prompt or Windows PowerShell with default user privileges. If the command output results in “System error 5,” you must launch your preferred command-line interpreter as an administrator.

    Open Command Prompt as Administrator

    1. Open the Start menu (or press the Windows key) and type cmd or command prompt.

    2. Select the Run as administrator option in the search results.

    3. Select Yes on the User Account Control (UAC) dialog box.

    Note: User Account Control is not present in Windows 7.

    You will then see a Command Prompt window with the “Administrator” label on the title bar. You won’t encounter the “System error 5” while executing commands anymore.

    A faster way to open Command Prompt as an administrator involves pressing Ctrl + Shift + Enter immediately after searching for it on the Start menu.

    Open Windows PowerShell as Administrator

    Both Windows 10 and 11 feature the option to open Windows PowerShell as an administrator via the Windows + X (a.k.a. Power User) menu.

    1. Press Windows + X or right-click the Start button.

    2. Select Windows Terminal (Admin) or Windows PowerShell (Admin).

    3. Select Yes on the User Account Control (UAC) prompt.

    You will then see a Windows PowerShell window (or tab if the console launches via Windows Terminal) with the “Administrator” label. “System error 5” will not show up while executing commands in it.

    Alternatively, you can search for powershell on the Start menu and select Run as administrator or press Ctrl + Shift + Enter to open an elevated Windows PowerShell window.

    Tip: Learn how to replace Windows PowerShell with Command Prompt on the Windows 10 Power User menu.

    Always Run an Elevated Command Prompt and Windows PowerShell Console

    It’s possible to build a desktop shortcut in Windows capable of automatically opening Command Prompt or Windows PowerShell as an administrator. That eliminates the chances of mistakenly launching a console with standard user privileges and encountering “System error 5.”

    1. Depending on the command-line interpreter you want to create a shortcut to, open a File Explorer window and head over to the relevant directory:

    Command Prompt — Local Disk C > Windows > System32

    Windows PowerShell — Local Disk C > Windows > System32 > WindowsPowerShell > v1.0

    2. Locate the file labeled cmd (Command Prompt) or powershell (Windows PowerShell). Then, right-click it and select Show more options (Windows 11 only) > Send to > Desktop (create shortcut).

    3. Right-click the newly created cmd – Shortcut or powershell – Shortcut icon on the desktop. Then, select Properties.

    4. Under the Shortcut tab, select Advanced.

    5. Check the box next to Run as administrator and select OK.

    6. Select Apply and OK to exit the Properties box.

    You can now double-click the shortcut and select Yes on the UAC pop-up to open Command Prompt or Windows PowerShell with administrative privileges. Feel free to rename the shortcut to whatever you like.

    Disable UAC Prompts for Command Prompt and Windows PowerShell

    User Account Control (UAC) is a security feature in Windows Vista, 8, 8.1, 10, and 11 that prevents programs from making changes to the system without permission. However, dealing with UAC prompts each time you want to open Command Prompt or Windows PowerShell with admin rights is distractive.

    The quickest way to deal with that is to disable UAC altogether. However, that poses a  significant security risk. Or, you can bypass the prompt only for Command Prompt or Windows PowerShell. That’s safer but takes time to set up.

    Disable User Account Control Completely

    1. Search for uac on the Start menu and select Open to launch the User Account Control Settings dialog.

    2. Drag the slider to Never notify.

    3. Select OK to deactivate User Account Control system-wide.

    To re-activate UAC later, simply go through the steps above and drag the slider to the first or second notch.

    Tip: You can also reach the User Account Control Settings dialog by selecting System and Security > Change User Account Control settings on the Control Panel.

    Bypass UAC for Command Prompt and Windows PowerShell Only

    1. Search for schtasks on the Start menu and press Enter to launch the Task Scheduler.

    2. Right-click Task Scheduler Library on the sidebar and select New Folder.

    3. Enter a name for the folder—e.g., No UAC

    4. Select the newly-created folder on the sidebar and select Create Task.

    5. Name the task—e.g., Command Prompt (Admin) and check the box next to Run with highest privileges.

    6. Switch to the Actions tab and select New.

    7. Set Action to Start a program and paste in the file path for the Command Prompt or Windows PowerShell executable:

    Command Prompt — C:\Windows\System32\cmd.exe

    Windows PowerShell — C:\Windows\System32\WindowsPowerShell\v1.0

    9. Switch to the Conditions tab and uncheck Start the task only if the computer is on AC power. Then, select OK to save the task.

    10. Right-click a vacant area within the desktop and select New > Shortcut.

    11. Enter the following path, replacing Folder name and Task name with the names that you inserted while creating the task:

    C:\Windows\System32\schtasks.exe /RUN /TN “Folder name\Task name”

    Select Next to continue.

    12. Type in a name for the shortcut and select Finish.

    13. Double-click the shortcut on the desktop that you just created, and a new elevated Command Prompt or Windows PowerShell console will launch without a UAC prompt.

    Fix System Error 5 on Standard Windows Accounts

    Suppose you encounter “System error 5 has occurred” in a non-administrator account on your PC. In that case, you can still run an enhanced Command Prompt or Windows PowerShell console using the instructions above by inserting an administrator password. If you don’t know it, ask for permission from a user with administrative privileges to the PC.

    Alternatively, you can change a standard account to an admin account (assuming that you’re the owner of your PC) to avoid having to type in an administrator password each time you want to open a command-line interpreter with elevated rights. The steps below apply to Windows 10 and 11.

    1. Sign in to your administrator account and select Start > Settings > Accounts > Family & other users.

    2. Select the standard account under Other users and select Change account type.

    3. Set Account type to Administrator and select OK.

    Fixed: System Error 5 Has Not Occurred

    To reiterate, simply running Command Prompt and Windows PowerShell as an administrator will fix the “System error 5” error code in Microsoft Windows. If you use both consoles regularly, taking the time to set up shortcuts that always launch them with elevated privileges (preferably without an annoying User Account Control prompt to deal with) will likely save hours in the long run.