How to Disable the Command Prompt on Windows 11
The Command Prompt is a powerful utility to manage system and app settings. If you want to disable access to it on your PC, however, follow this guide.
Using the command line on Windows allows administrators to tackle specific tasks quickly. However, you might want to disable the Command Prompt for certain users so they cannot run commands.
While Microsoft is phasing out the Command Prompt, it’s still a helpful yet powerful utility. Running the wrong command can have negative impacts. And disabling it protects against unwanted system changes.
Since you can still use it to configure system settings and apps, blocking it from running if a user doesn’t need it is a good idea. So, here are the steps for disabling it on your Windows PC.
How to Disable Command Prompt on Windows
If you need to prevent access to the command line utilities, there are a few different methods to do it. For example, if you are running the Pro version of Windows 10 or 11 or higher, you can block it from Group Policy.
If you’re running the Home versions of Windows, however, you’ll need to modify values in the Registry (which we’ll explain in the next section). The following steps will disable the Command Prompt on Windows 10 or 11 Pro and above.
To disable the Command Prompt using the Group Policy Editor on Windows:
- Press Windows key + R to launch the Run dialog.
- Type gpedit.msc and click OK or press Enter.
- Navigate to the following location in Group Policy Editor:
User Configuration > Administrative Templates > System
- Double-click the Prevent access to the command prompt policy in the right column.
- Select Enabled on the following screen to disable command prompt access.
- In the Options section, select Yes from the dropdown to prevent the user from running .bat or .cmd file types.
Note: If the PC runs batch files during logon, logoff, startup, shutdown, or uses remote desktop (RDP), you should leave this setting unchanged. - Click Apply and OK to save the changes.
To reenable the Command Prompt in the future, go back in and set the Prevent access to the command prompt policy to Not Configured.
How to Disable Command Prompt from the Windows Registry
If you’re running Windows Home, you’ll need to disable the Command Prompt using the Windows Registry Editor (or regedit).
Important: Editing the Registry isn’t recommended for beginning users. Deleting a wrong key or entering an incorrect value can lead to an unstable or unrecoverable PC. Before making any changes, back up the Registry and create a system backup so you can recover Windows.
To disable the Command Prompt using the Registry on Windows:
- Press Windows key + R to launch the Run dialog.
- Type regedit and click OK or press Enter.
- Navigate to the following section in Registry Editor:
HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows
- Right-click the Windows key and select New > Key from the menu.
- Name the key to System.
- Right-click the newly created System key and select New > DWORD (32-bit) Value.
- Name the new value at DisableCMD, and set its value data to 2 to disable the prompt but allow batch files. Or set it to 1 to disable the prompt and prevent batch files from running.
- After entering a value, click OK.
- Close out of the Registry Editor and restart Windows.
Moving forward, the Command Prompt is disabled and unable to run for the user. If you want to enable it later, set the DisableCMD value to 0 instead.
Whichever option you use, once the Command Prompt is disabled, a user can still search for it and launch it. However, they will be greeted with a message indicating it’s disabled by the administrator. Press any key, and the prompt will close—even when trying to run as an administrator.
Maintaining Control on Windows 11
If you have a child or other user who isn’t tech savvy (or enough to be dangerous), disabling the Command Prompt will help protect system stability. And if you want to enable it again in the future, the process is straightforward following the above steps.
As an administrator, you can do other things to ensure your system stays secure. For example, you can disable third-party app installations where users can only install apps from the Microsoft Store.
There are other features in Windows that you might need to disable. For example, you may need to temporarily disable Windows Security to allow a trusted file to install, or you can disable Bing Chat AI from Windows Search.