How to Disable the Windows Command Prompt or PowerShell (2024)

The Windows Command Prompt and PowerShell tools are quite incredible. You can use them to configure various system settings or access various apps. However, entering the wrong commands in these tools can harm your device. In some instances, others might use these tools to run unwanted commands on your PC.

The best solution to such problems is to temporarily disable the 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) the Command Prompt and PowerShell.

How to Disable the Windows Command Prompt

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

Using the Local Group Policy Editor

How to Disable the Windows Command Prompt or PowerShell (1)

We’ll start by using the Local Group Policy Editor (LGPE). If you’re 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 the Windows sound scheme settings.

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

Now, here's how to use the LGPE to disable the Command Prompt:

  1. Press Win + R to open the Run command dialog box.
  2. Type gpedit.msc and press Enter to open the LGPE.
  3. Navigate to User Configuration > Administrative Templates > System.
  4. Double-click on the Prevent access to the command prompt option on the right-hand side pane.
How to Disable the Windows Command Prompt or PowerShell (2)

From there, select Enabled in the top-left corner. Next, press Apply and then press OK. This should disable the Windows Command Prompt.

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

  1. Open the LGPE and navigate to the System option by following the previous steps.
  2. Double-click on the Prevent access to the command prompt option.
  3. From there, select either Not Configured or Disabled from the options. Finally, press Apply and then press OK.

Using the Registry Editor

How to Disable the Windows Command Prompt or PowerShell (3)

Alternatively, you could try using the Windows Registry Editor. This is an incredible tool that you can rely on for tweaking system settings or troubleshooting errors.

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

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

  1. Press Win + R to open the Run command dialog box.
  2. Type Regedit and press Enter to open the Registry Editor.
  3. From there, copy-paste the following command into the address bar and press Enter:
HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows

Click the System key under the Windows folder. If the System key is missing, create it by right-clicking on the Windows key and selecting New > Key. Next, rename the key as System and then press Enter.

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

How to Disable the Windows Command Prompt or PowerShell (4)

To disable the Command Prompt, double-click on the DisableCMD value and set the Value data to 1. From there, press OK and then close the Registry Editor.

To re-enable the Command Prompt, apply the previous methods but set DisableCMD's Value data to 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. Type gpedit.msc and press Enter to open the LGPE.
  3. Navigate to User Configuration > Administrative Templates > System.
  4. Double-click on the Don't run specified Windows applications option on the right-hand side pane.
How to Disable the Windows Command Prompt or PowerShell (5)

Next, select Enabled in the top-left corner. From there, navigate to the Options section in the bottom-left and click the Show button. This should pop up the Show Contents screen.

Type powershell.exe below the Value box and then press OK. Next, press Apply and then press OK 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 the System option as per the previous steps.
  2. Double-click on the Don't run specified Windows applications option.
  3. Finally, select either Not Configured or Disabled in the top-left corner. Finally, press Apply and then press OK.

However, it’s worth noting that this method will make changes to all the programs that depend on the "Don't run specified Windows applications" policy setting. For example, if you disable PowerShell using this policy setting, the other apps that depend on this policy setting will also be disabled.

Using the Registry Editor

How to Disable the Windows Command Prompt or PowerShell (6)

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

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

Click on the Explorer key. 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 Enter.

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

How to Disable the Windows Command Prompt or PowerShell (7)

Next, follow these steps:

  1. Right-click on a blank space on the right-hand side and select New > key. Next, name this key as DisallowRun.
  2. Click the DisallowRun key and then right-click on a blank space on the right-hand side. Next, select New > String Value and then name the value as 1.
  3. Next, double-click on this newly-created value and set the Value data as powershell.exe. Press OK to save these changes. Now, you should have a value named “1,” with a data value displayed as “powershell.exe.”
How to Disable the Windows Command Prompt or PowerShell (8)

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 the apps that are 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 the Explorer key as per the previous steps.
  2. Double-click on the DisallowRun value on the right-hand side and set the Value data to 0. Press OK to save these changes.
  3. If you want to enable PowerShell for good, navigate to HKEY_CURRENT_USER > Software > Microsoft > Windows > CurrentVersion > Policies > Explorer > DisallowRun and delete the PowerShell string.

The Command Prompt and PowerShell Are Now Inaccessible

There’s no denying that the Command Prompt and PowerShell tools are useful and reliable. However, it’s often necessary to disable them—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 various ways to access the Command Prompt and PowerShell.

  • Windows
  • Windows 10
  • Windows 11

Your changes have been saved

Email is sent

Email has already been sent

Please verify your email address.

You’ve reached your account maximum for followed topics.

Manage Your List

Follow

Followed

Follow with Notifications

Follow

Unfollow

Readers like you help support MakeUseOf. When you make a purchase using links on our site, we may earn an affiliate commission. Read More.

How to Disable the Windows Command Prompt or PowerShell (2024)

FAQs

How to Disable the Windows Command Prompt or PowerShell? ›

Add rules to block the execution of `cmd.exe` (Command Prompt) and `powershell.exe` (PowerShell) on managed computers. You'll need to provide the full path to these executables. Once you've configured the policy to disable CMD and PowerShell, apply the policy to the relevant group of managed computers.

How to disable CMD and PowerShell? ›

Add rules to block the execution of `cmd.exe` (Command Prompt) and `powershell.exe` (PowerShell) on managed computers. You'll need to provide the full path to these executables. Once you've configured the policy to disable CMD and PowerShell, apply the policy to the relevant group of managed computers.

How do I disable the CMD prompt? ›

Disabling the Command Prompt on Windows
  1. Click the Windows Start button and type gpedit. ...
  2. Navigate to User Configuration > Administrative Templates > System.
  3. Double-click Prevent access to the command prompt option on the right-hand side pane.
Jun 12, 2023

How do I turn off Windows from command prompt? ›

You can execute the same command from a Run window. Open a Command Prompt, PowerShell or Run window, and type the command "shutdown /s" (without quotation marks) and press Enter on your keyboard to shut down your device.

How do I stop the Windows PowerShell process? ›

Run the Windows kill process with PowerShell

Type “Get-Process” to display a list of all currently running processes, their names and PIDs. If you know the name of the process, you can terminate it with the PowerShell Stop-Process by typing Stop-Process -Name “ProcessName” -Force.

Can PowerShell be disabled? ›

Summary. PowerShell is a core component to the Windows OS and there is no safe way to remove it. Disabling PowerShell through settings prevents the invocation of the executable, but does not prevent invocation from alternative entry points. Instead, PowerShell should be hardened and monitored.

How to deactivate Windows cmd? ›

Open a Command Prompt with administrative privileges and execute slmgr /upk to deactivate the existing license. Perform a clean installation of Windows Server 2022 and enter the same product key that you used previously.

How do I stop Windows from running in Command Prompt? ›

Use Ctrl + C to stop a command from running. NOTE: This is not an undo. The command will only stop the current command during its process.

How do I turn off Windows commands? ›

First, navigate to User Configuration > Go to Administrative Templates> Windows Components > File Explorer. Now, users need to double-click on the Turn Off Windows Key Hotkeys option to turn off shortcuts for hotkeys.

How do I disconnect from Command Prompt? ›

How to Disconnect from a Server or File Share
  1. Open a command prompt by either: ...
  2. Type " net use " and press enter to view your active SMB connections.
  3. Type " net use /delete \\servername\sharename " and press enter. ...
  4. Type " net use " again to verify that the desired connection has been deleted.

Should I disable Windows PowerShell? ›

If you're talking about disabling PowerShell itself, at the very least, you could run into issues with installers. More and more installers are using PowerShell code/scripts to do “something” when installing their program, and if they can't run their intended PowerShell commands, your install will fail.

How do I stop a PowerShell command? ›

How do I stop a PowerShell command from running? You can interrupt and stop a PowerShell command while it is running by pressing Control-C. A script can be stopped with the command exit. This will also close the PowerShell console.

How do I stop Windows PowerShell service? ›

To disable a service using a PowerShell command, use these steps:
  1. Open Start.
  2. Search for PowerShell, right-click the top result, and select the Run as administrator option.
  3. Type the following command to disable a service and press Enter: Set-Service -Name "SERVICE-NAME" -Status stopped -StartupType disabled.
Dec 22, 2022

How to disable CMD service? ›

To disable a service with Command Prompt, use these steps:
  1. Open Start.
  2. Search for Command Prompt, right-click the top result, and select the Run as administrator option.
  3. Type the following command to disable a service and press Enter: sc config "SERVICE-NAME" start=disabled.
Dec 22, 2022

How to stop PowerShell script CMD? ›

Ctrl + C: This keyboard shortcut is the most common way to stop a running script in PowerShell. Simply press the Ctrl key and the C key simultaneously, and the execution of the script will be terminated. 2. Ctrl + Break: This keyboard shortcut can also be used to stop a running script.

How do I stop a CMD process? ›

How do you stop a command in cmd?
  1. Enter command “tasklist | more” to list all running process with its Process Name and PID Number.
  2. Now, you can terminate the process either using. Process Name – Command [ taskkill /IM “process name” /F ] PID Number – Command [ taskkill /F /PID pid_number ]
Jun 24, 2024

How do I open PowerShell instead of CMD? ›

For those who prefer using Command Prompt, you can opt out of the Windows Logo Key + X change by opening Settings > Personalization > Taskbar, and turning off, Replace Command Prompt with Windows PowerShell in the menu when I right-click the start button or press Windows key+X.

Top Articles
11 of the World’s Most Unbelievable Swords
How to Deal With Disrespectful People: 12 Steps (with Pictures)
Kevin Cox Picks
Hannaford Weekly Flyer Manchester Nh
Mcoc Immunity Chart July 2022
Gameplay Clarkston
Craigslist In Fredericksburg
7543460065
Palace Pizza Joplin
1TamilMV.prof: Exploring the latest in Tamil entertainment - Ninewall
Select Truck Greensboro
Burn Ban Map Oklahoma
D10 Wrestling Facebook
Lesson 8 Skills Practice Solve Two-Step Inequalities Answer Key
Bx11
Beebe Portal Athena
U Arizona Phonebook
Odfl4Us Driver Login
Craigslist Maui Garage Sale
Jet Ski Rental Conneaut Lake Pa
2024 INFINITI Q50 Specs, Trims, Dimensions & Prices
Att.com/Myatt.
Empire Visionworks The Crossings Clifton Park Photos
Sand Dollar Restaurant Anna Maria Island
Bay Area Craigslist Cars For Sale By Owner
27 Modern Dining Room Ideas You'll Want to Try ASAP
Radical Red Ability Pill
Afni Collections
Narragansett Bay Cruising - A Complete Guide: Explore Newport, Providence & More
Summoners War Update Notes
Obsidian Guard's Skullsplitter
Loopnet Properties For Sale
La Qua Brothers Funeral Home
Half Inning In Which The Home Team Bats Crossword
Etowah County Sheriff Dept
Radical Red Doc
Babylon 2022 Showtimes Near Cinemark Downey And Xd
Poe Flameblast
Lovein Funeral Obits
Japanese Big Natural Boobs
Best Restaurants Minocqua
3 bis 4 Saison-Schlafsack - hier online kaufen bei Outwell
Lucyave Boutique Reviews
Coffee County Tag Office Douglas Ga
Arcanis Secret Santa
877-552-2666
Nope 123Movies Full
Contico Tuff Box Replacement Locks
552 Bus Schedule To Atlantic City
Identogo Manahawkin
1Tamilmv.kids
Msatlantathickdream
Latest Posts
Article information

Author: Catherine Tremblay

Last Updated:

Views: 5972

Rating: 4.7 / 5 (47 voted)

Reviews: 94% of readers found this page helpful

Author information

Name: Catherine Tremblay

Birthday: 1999-09-23

Address: Suite 461 73643 Sherril Loaf, Dickinsonland, AZ 47941-2379

Phone: +2678139151039

Job: International Administration Supervisor

Hobby: Dowsing, Snowboarding, Rowing, Beekeeping, Calligraphy, Shooting, Air sports

Introduction: My name is Catherine Tremblay, I am a precious, perfect, tasty, enthusiastic, inexpensive, vast, kind person who loves writing and wants to share my knowledge and understanding with you.