How to disable Command Prompt access on Windows 10?

The Command Prompt console is a valuable and built-in tool on Windows 10 to quickly execute commands to make system settings and run non-graphical apps. It also helps in troubleshooting problems and automates tasks. If you want to disable the Command Prompt access for all users to prevent users from running unwanted commands, the task can be achieved through two methods.

In other words, you can prohibit access to the Command Prompt on Windows 10 through at least two ways: Group Policy Editor or Registry Editor.

In this post, we will learn two possible ways to disable the Command Prompt console for all users on Windows 10:-

  1. How to restrict Command Prompt access with Group Policy Editor?
  2. How to disable Command Prompt with Registry?

How to restrict Command Prompt access with Group Policy Editor?

If you are running Windows 10 Pro (Enterprise or Education), Local Group Policy is the easiest way to block users from using Command Prompt. If you are still using Windows 10 Home Edition, then either use the registry method or enable Group Policy Editor on Windows 10 Home, then proceed further with this method.

Step 1. Press Windows Logo + R keys to open the Run dialog box.

Step 2. Type the following and press Enter from the keyboard to open the Local Group Policy Editor window:-

gpedit.msc

Step 3. In the Local Group Policy Editor window, navigate to the following path:-

User Configuration > Administrative Templates > System

Step 4. On the right side pane, double-click the policy “Prevent access to the command prompt.”

Step 5. Select the Enabled option.

Note: Under the “Options” section, you can use the drop-down menu to select whether you want to allow or disallow running batch files (.bat and .cmd) on your computer when Command Prompt is disabled.

Step 6. Click the Apply and then the OK button.

Once you have completed the above-mentioned steps, all users on your Windows 10 machine can still open the console. But, they will receive a “The command prompt has been disabled by your administrator” message with an option to press any key to terminate the session.

These changes are immediate, which means there is no need to restart your PC.

Also, depending on your configuration, Command Prompt scripts will no longer process.

If you want to allow access to Command Prompt on your PC, on Step 5, select the Not Configured option.

How to disable Command Prompt with Registry Editor?

Note: Before proceeding with Registry editing, you should create a backup of registry files.

This method is applicable for all versions of Windows 10, including the Windows 10 Home edition. To disable Command Prompt with Registry Editor, do the following steps:-

Step 1. Press Windows Logo + R keys to open the Run dialog box.

Step 2. Type the following and press Enter from the keyboard to open the Registry Editor window:-

regedit

Step 3. Browse the following path:-

HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows

Step 4. Right-click on the Windows key and select the New then Key option.

Step 5. Name the new key System and press Enter from the keyboard.

Step 6. Now, right-click the System key, select New and choose the DWORD (32-bit) Value option.

Step 7. Name the newly created DWORD DisableCMD.

Step 8. Double-click the newly created DWORD and set the value from 0 to 2 to disable Command Prompt while batch files will continue to run on the device.

Step 9.  If you want to disable Command Prompt as well as batch files on your Windows 10 PC, change the newly created DWORD value from 0 to 1.

Step 10. Click OK.

Once you complete the above-mentioned steps, all users on your Windows 10 machine can still open the console. But, they will receive a “The command prompt has been disabled by your administrator” message with an option to press any key to terminate the session.

These changes are immediate, which means there is no need to restart your machine.

If you want to allow the users to access Command Prompt, repeat the above steps and change the Value data to 0 in above Step 8.

Leave a Reply