close
close

How to disable Windows Command Prompt or PowerShell

The Windows Command Prompt and PowerShell tools are pretty awesome. You can use them to configure various system settings or access various applications. However, entering the wrong commands in these tools can damage your device. In some cases, these tools can be used by others to execute unwanted commands on your PC.

The best solution to such problems is to temporarily disable Command Prompt or PowerShell. Fortunately, if you ever need to use these tools again in the future, you can re-enable them at any time. As such, here are the various ways to disable (and re-enable) Command Prompt and PowerShell.


How to disable Windows Command Prompt

You can disable Command Prompt using Local Group Policy Editor or Registry Editor. So let’s take a look at the steps you need to follow.

Using the Local Group Policy Editor

We’ll start by using the Local Group Policy Editor (LGPE). If you are familiar with this tool, you probably know that it makes it easy to modify various system settings. Not only that, but this tool can also help you block access to Windows sound scheme settings.

If you can’t access this tool in Windows Home edition, check out some tips on how to access the LGPE in Windows Home.

Now, here is how to use the LGPE to disable the command prompt:

  1. Press Win + R to open the Run command dialog box.
  2. Write gpedit.msc and press Get into to open the LGPE.
  3. navigate to User Configuration > Administrative Templates > System.
  4. Double click on the Prevent access to the command prompt option in the right side panel.

From there select Activated in the top left-hand corner. Then press Apply and then press okay. This should disable the Windows Command Prompt.

If you decide to re-enable Command Prompt, follow these steps:

  1. Open the LGPE and navigate to System option by following the steps above.
  2. Double click on the Prevent access to the command prompt option.
  3. From there select any not configured either disabled of the options. Finally press Apply and then press okay.

Using Registry Editor

Alternatively, you can try using the Windows Registry Editor. This is an amazing tool that you can trust to adjust system settings or fix errors.

Registry Editor keeps sensitive keys that control how your Windows device works. Therefore, you must be careful when editing or moving registry keys. In fact, the best thing to do is to back up the Registry before you make any changes to it.

Now, here is how to use Registry Editor to disable Command Prompt:

  1. Press Win + R to open the Run command dialog box.
  2. Write regedit and press Get into to open Registry Editor.
  3. From there, copy and paste the following command into the address bar and hit Get into:

HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows

Click on the System key in the Windows folder. If the system key is missing, create it by right-clicking on the windows key and selecting New > Key. Then rename the key like System and then press Get into.

when you’re in the System key, right-click on a blank space to the right and select New > DWORD (32-bit) Value. From there, name the value as DisableCMD.

To disable the command prompt, double-click the DisableCMD value and set the value data a 1. From there, press okay and then close Registry Editor.

To re-enable the command prompt, apply the above methods but set DisableCMD’s value data a 0 (zero).

Now, let’s explore how you can disable the PowerShell tool.

Using the Local Group Policy Editor

Here’s how to use the LGPE to disable PowerShell:

  1. Press Win + R to open the Run command dialog box.
  2. Write gpedit.msc and press Get into to open the LGPE.
  3. navigate to User Configuration > Administrative Templates > System.
  4. Double click on the Do not run specified Windows applications option in the right side panel.


Then select Activated in the top left-hand corner. From there, navigate to the Options at the bottom left and click the Show button. This should appear show content screen.

Write powershell.exe under the Worth box and then press okay. Then press Apply and then press okay in the LGPE window. This should disable the PowerShell tool.

In case you want to re-enable PowerShell, follow these steps:

  1. Open the LGPE and navigate to System option according to the steps above.
  2. Double click on the Do not run specified Windows applications option.
  3. Finally select any not configured either disabled in the top left-hand corner. Finally press Apply and then press okay.

However, it is worth noting that this method will make changes to all programs that depend on the “Do not run specified Windows applications” policy setting. For example, if you disable PowerShell with this policy setting, the other applications that depend on this policy setting will also be disabled.

Using Registry Editor

This is how Registry Editor can help you disable the PowerShell tool:

  1. Press Win + R to open the Run command dialog box.
  2. Write regedit and press Get into to open Registry Editor.
  3. From there, copy and paste the following command into the address bar and hit Get into:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies

Click on the Explorer wrench. If this key is missing, create it by right-clicking on the Policies key and selecting New > Key. Name the key as Explorer and then press Get into.

Once you’re on the Explorer key, right-click on a blank space to the right and select New > DWORD (32-bit) Value. Then name the value as DisallowRun. From there, double click on the DisallowRun value and set the value data a 1.

Then follow these steps:

  1. Right click on a blank space on the right side and select new > key. Then name this key as DisallowRun.
  2. Click on the DisallowRun and then right click on a blank space on the right side. Then select New > String Value and then name the value as 1.
  3. Then double click on this newly created value and set the value data What powershell.exe. Press okay to save these changes. Now, you should have a value called “1”, with a data value showing as “powershell.exe”.


The steps we’ve covered so far should disable the PowerShell tool. That’s because we started by setting the value data of the DisallowRun value as 1.

Also, this method will disable all apps found in the DisallowRun folder/key.

To re-enable PowerShell (or other apps within the DisallowRun key), follow these steps:

  1. Open the registry editor and navigate to Explorer key as in the previous steps.
  2. Double click on the DisallowRun value on the right hand side and set the value data a 0. Press okay to save these changes.
  3. If you want to enable PowerShell forever, go to HKEY_CURRENT_USER > Software > Microsoft > Windows > Current version > Policies > Browser > DisallowRun and remove the Shell Power string.

Command Prompt and PowerShell are now inaccessible

There is no denying that the Command Prompt and PowerShell tools are useful and reliable. However, it is often necessary to disable them, especially if you want to prevent others from executing unwanted commands. To disable these tools, apply any of the methods we have covered.


While you’re at it, be sure to also check out the various ways to access Command Prompt and PowerShell.

Leave a Comment