en-US windows user

Prevent access to the command prompt

Verified with Windows 11 25H2 — updated on July 10, 2026

Windows 11 25H2

Supported on: At least Windows 2000

Path in the GPO console

User Configuration\Administrative Templates\System

Description

This policy setting prevents users from running the interactive command prompt, Cmd.exe. This policy setting also determines whether batch files (.cmd and .bat) can run on the computer. If you enable this policy setting and the user tries to open a command window, the system displays a message explaining that a setting prevents the action. If you disable this policy setting or do not configure it, users can run Cmd.exe and batch files normally. Note: Do not prevent the computer from running batch files if the computer uses logon, logoff, startup, or shutdown batch file scripts, or for users that use Remote Desktop Services.

Registry

HKCU Software\Policies\Microsoft\Windows\System

More options available

Options

Disable the command prompt script processing also?
DisableCMD enum
  • Yes -> 1
  • No -> 2 (default)

Export Builder

BETA

Configure the state, scope and options, then generate .reg, PowerShell, Intune and SCCM outputs — or add the setting to a multi-setting collection.

These exports write the registry — this is not a managed GPO.

.reg file

Windows Registry Editor Version 5.00

; Exported from gporais.com
; Policy: Prevent access to the command prompt
; State: Enabled
; Supported on: At least Windows 2000

[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\System]
"DisableCMD"=dword:00000002
More formats (PowerShell, Intune, SCCM)

PowerShell

# Exported from gporais.com
# Policy: Prevent access to the command prompt
# State: Enabled
# Supported on: At least Windows 2000
# Warning: In SYSTEM context (the Intune default), HKCU targets the SYSTEM profile. Run this script using the logged-on credentials.

$path = 'HKCU:\Software\Policies\Microsoft\Windows\System'
New-Item -Path $path -Force | Out-Null
Set-ItemProperty -Path $path -Name 'DisableCMD' -Value 2 -Type DWord

Building a multi-setting collection? Add this setting and generate combined .reg / PowerShell / GPO scripts.

Open the Builder

Embed this policy on your site

What to embed
Theme

Adds one script line: the theme follows your site’s appearance and the height fits the content. If your site blocks scripts, the embed follows the visitor’s system theme.

Preview