How to Disable Command Prompt in Windows 10/8/7 - Windows Basics

Latest

Thursday, March 19, 2020

How to Disable Command Prompt in Windows 10/8/7

A command prompt is an entry point for typing computer commands in the Command Prompt window. By typing commands at the command prompt, you can perform tasks on your computer without using the Windows graphical interface.
Want to restrict users from opening Command Prompt or running command-line scripts? Follow these steps to disable Command Prompt in Windows.
In Windows, any user can open the Command Prompt and run commands or other scripts without much resistance. This is useful because you can run simple commands and get information that is otherwise unavailable or hard to get in the regular mode. Of course, if you want to run commands or scripts that require admin privileges then the command will prompt for those permissions.
That being said, Command Prompt is not for everyone and most seldom use it. So, if you are sure you don't need the Command Prompt or if you want to restrict other users from accessing the Command Prompt, Windows has a hidden way to disable Command Prompt.
So, without further ado, let me show you can disable the Command Prompt and Command Prompt script execution in Windows 10, 7, and 8.
This tutorial will show you how to enable or disable the command prompt and optionally BAT and CMD scripts for your account, specific users, or all users in Windows 7, Windows 8, and Windows 10.
Method 1: Disable the Command Prompt using Group Policy Editor
1. Pressing Windows Key + R combination. Type gpedit.msc in the box and click OK. Then local Group Policy Editor will open.
2. In the Group Policy Editor that opens, do the following steps. First, in the left side pane, expand User Configuration > Administrative Templates and then select System. So in the right side pane, you will see a policy setting named Prevent access to the command prompt.  This policy is not configured by default, which means the Command Prompt is enabled and accessible by default. Double-click this policy to enable it if you want to disable the command prompt.
3. Select Enabled, and then click Apply followed by OK.
Changes take effect immediately, and the Command Prompt is disabled. From now on, you can open the Command Prompt window, but you can’t perform any task in the window. When you open the Command Prompt window, it will display a message in the window: The command prompt has been disabled by your administrator. Press any key to continue, as shown in the screenshot below.

Whenever you need to enable the Command Prompt just set this policy to Not Configured.
Method 2: Disable the Command Prompt using Registry Editor
If your Windows 10 does not include Local Group Policy Editor, you can use Registry Editor to disable the Command Prompt. Here are steps.
1. Press Windows Keys+ R to bring out the Run dialog. Type regedit in the box and click “OK”.
2. In the left side pane of the Registry Editor, navigate to the key: KEY_CURRENT_USER\Software\Policies\Microsoft\Windows\System.
If the System key does not exist under the Windows key, you need to create it. Right click on the Windows key and select New > Key to create a new key, and then name it as System.
3. Within the System key, you can see a DWORD value named DisableCMD. If the DisableCMD value does not exist, you need to create it. 
4. Right click on the System key, and select New > DWORD (32-bit) Value to create a new DWORD value; name the new value as DisableCMD. The value data of the DisableCMD is 0 by default, which means the Command Prompt is enabled and accessible by default. If you want to disable the Command Prompt, double-click the DisableCMD value and set its value data to 2.
Finally, close the Registry Editor. That’s it. Now the Command Prompt has been disabled. Whenever you need to enable it, just set the DisableCMD value data to 0 or delete this value.
Video:

No comments:

Post a Comment