Here are two ways to disable the Command Prompt in Windows 10. Let’s get started.
Navigate to the User Configuration > Administrative Templates > System.
Double-click “Prevent access to the command prompt” in the right pane.
Select Yes from the drop-down list if you do not wish to run batch files (.cmd and .bat).
Click the OK button.
To enable Command Prompt, follow the above steps but select Not Configured or Disabled.
Go to HKEY_CURRENT_USER > Software > Policies > Microsoft > Windows.
Hit System. If it is not there, create it. You can do this by right-clicking on Windows and selecting New > Key, then typing System and hitting Enter.
Now right-click on the blank space in the right pane.
Select New > DWORD (32-bit) Value.
Enter DisableCMD and press Enter.
Double-click it and enter 2 (to disable Command Prompt) or 1 (to disable Command Prompt and running batch files) in the Value field.
Hit the OK button.
From now on, you will see this message every time you access the Command Prompt:
The command prompt has been disabled by your administrator.
Press any key to continue.
Note: To enable Command Prompt, remove the DWORD you’ve created above.