How to disable Windows Command Prompt or PowerShell

A computer screen displaying programming commands and texts

The Windows Command Prompt and PowerShell tools are absolutely amazing. You can use it to configure various system settings or access various applications. However, entering wrong commands into these tools can harm your device. In some cases, others may use these tools to run unwanted commands on your computer.

The best solution to these 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 different ways to disable (and re-enable) the Command Prompt and PowerShell.


How to disable Windows Command Prompt

You can disable Command Prompt by using Local Group Policy Editor or Registry Editor. So, let’s check out the steps you need to follow.

Using the Local Group Policy Editor

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

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

Now, here is how you can use LGPE to disable Command Prompt:

  1. press Win + R. To open the Run dialog box.
  2. Writes gpedit.msc and press Enters To open the LGPE file.
  3. Go to User Configuration > Administrative Templates > System.
  4. Double click a file Prevent access to Command Prompt option in the right pane.

From there choose maybe in the upper left corner. After that, press Progressing then press yes. This should disable the Windows Command Prompt.

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

  1. open the LGPE and go to System option by following the previous steps.
  2. Double click a file Prevent access to Command Prompt Selection.
  3. From there, select either not configured or helpless of options. Finally, press Progressing then press yes.

Using the Registry Editor

Alternatively, you can try using the Windows Registry Editor. This is a great tool that you can rely on for tweaking system settings or troubleshooting.

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

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

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

HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows

tap on System key under the Windows folder. If the system key is missing, create it by right-clicking on a file windows key and choose New > Key. Next, rename the key as System then press Enters.

when you are in System key, right-click an empty space on the right and select New Value > DWORD (32-bit). From there, name the value as DisableCMD.

To disable Command Prompt, double-click File DisableCMD value and set value data to me 1. From there click yes Then close the Registry Editor.

To re-enable Command Prompt, apply the previous methods but set DisableCMD’s value data to me 0 (zero).

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

Using the Local Group Policy Editor

Here’s how to use LGPE to disable PowerShell:

  1. press Win + R. To open the Run dialog box.
  2. Writes gpedit.msc and press Enters To open the LGPE file.
  3. Go to User Configuration > Administrative Templates > System.
  4. Double click a file Do not run selected Windows applications option in the right pane.


Next, select maybe in the upper left corner. From there, go to Options at the bottom left and click Displays button. This should pop up a file View Contents Monitor.

Writes Powershell under the Values square and press yes. After that, press Progressing then press yes in the LGPE window. This should disable the PowerShell tool.

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

  1. open the LGPE and go to System Option according to the previous steps.
  2. Double click a file Do not run selected Windows applications Selection.
  3. Finally, select either not configured or helpless in the upper left corner. Finally, press Progressing then press yes.

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

Using the Registry Editor

Here’s how the Registry Editor can help you disable the PowerShell tool:

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

Click on explorer a key. If this key is missing, create it by right-clicking on File Policies key and choose New > Key. key name as explorer then press Enters.

Once you get to the Explorer key, right-click on an empty space on the right and select New Value > DWORD (32-bit). Next, name the value as DisallowRun. From there, double-click on File DisallowRun value and set value data to me 1.

Then, follow these steps:

  1. Right-click on an empty space on the right side and select New > Key. Next, name this key as DisallowRun.
  2. tap on DisallowRun key and then right-click on an empty space on the right side. Next, select New > String value Then name the value as 1.
  3. Next, double click on this newly created value and set File value data as such Powershell. press yes to save these changes. Now, you should have a value called “1”, displaying a data value named “powershell.exe”.


The steps we’ve covered so far should disable the PowerShell tool. This is because we started by setting a file value data From the value of DisallowRun as 1.

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

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

  1. open the Registry Editor and go to explorer Key according to the previous steps.
  2. Double click a file DisallowRun The value is on the right side and adjust value data to me 0. press yes to save these changes.
  3. If you want to enable PowerShell for good, go to HKEY_CURRENT_USER > Software > Microsoft > Windows > CurrentVersion > Policies > Explorer > DisallowRun and delete a file Powershell series.

Command Prompt and PowerShell can now be accessed

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


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

Related posts

Leave a Comment