|

How To Turn Off Data Execution Prevention In Windows (2026)

Data Execution Prevention, or DEP, is a Windows memory protection that you can turn off for one program or for the whole PC.

Microsoft documents both methods, and the one-program method is far safer than the system-wide one.

This guide shows each method with the exact settings, plus the command that turns DEP back on.

Table of Contents

Quick answer

GoalMethodRisk
Stop DEP for one programWindows Security > Exploit protection > Program settingsLower, limited to that program
Stop DEP for one program by commandSet-ProcessMitigation in PowerShellLower, limited to that program
Turn DEP off for everythingbcdedit /set nx AlwaysOff, then restartHighest, affects the whole PC
Put it backbcdedit /set nx OptIn, then restartRestores the default

What DEP does

Microsoft describes DEP as a set of hardware and software technologies that check memory to help protect against malicious code.

Hardware-enforced DEP marks all memory locations in a process as non-executable unless they explicitly contain executable code.

When code tries to run from non-executable memory, DEP intercepts the attempt and raises an exception.

Microsoft’s developer page says that if the exception is not handled, the calling process is terminated.

Why people turn it off

The usual reason is an older program that closes or shows an error as soon as DEP stops it.

Microsoft’s developer documentation says dynamic code generation, such as JIT, can break on a DEP-enabled system if the generated code is not marked as executable.

It also says ATL 7.1 and earlier can run code on non-executable pages, which triggers a fault that ends the application.

Microsoft’s page says DEP is not meant to be a complete defence, but it is one more layer you give up when you switch it off.

Before you start

  • Sign in with an administrator account, because the commands need administrator rights.
  • Try the one-program method first, since it leaves DEP on for everything else.
  • Only change the program you trust, because turning DEP off removes a protection against attacks on that program.

Microsoft says DEP can be configured only for 32-bit (x86) apps in exploit protection, and it is permanently enabled for other architectures.

Turn off DEP for one program in Windows Security

  1. Open Windows Security from the taskbar shield icon or the Start menu.
  2. Select App & browser control, then select Exploit protection.
  3. Under Program settings, select Add program to customize, or select the program if it is already listed and choose Edit.
  4. Choose Add by program name (include the .exe extension) or Choose exact file path.
  5. Find Data Execution Prevention (DEP), tick Override system settings and set the switch to Off.
  6. Select Apply.

Microsoft says Windows may ask you to restart the process, the app or the device, and a User Account Control prompt may need administrator credentials.

Program settings take precedence over System settings when both define the same mitigation.

Program name or exact path

OptionWhat it does
Add by program nameApplies to any running process with that name, and you must include the file extension
Enter a full path with the nameLimits the setting to that location
Choose exact file pathOpens a standard file picker so you pick the program
AuditApplies a mitigation in audit mode only

Turn off DEP for one program with PowerShell

Microsoft’s exploit protection page shows Set-ProcessMitigation for DEP and these commands come from it, with Disable swapped in for Enable.

Open Windows Terminal (Admin) and run the command with your program’s name.

Set-ProcessMitigation -Name program.exe -Disable DEP

To check what is set for that program, run the command below.

Get-ProcessMitigation -Name program.exe

To remove your override so the program follows the system default again, Microsoft shows this form.

Set-ProcessMitigation -Name program.exe -Remove -Disable DEP

Turn off DEP for the whole PC

Only use this if a single-program override did not fix the problem, and be ready to undo it.

  1. Select Start, type cmd, then select Run as administrator for Command Prompt.
  2. Type bcdedit /set nx AlwaysOff and press Enter.
  3. Restart the PC, because Microsoft says any change to a boot option requires a restart.

Microsoft’s BCDEdit page warns that changing some boot entry options could render your computer inoperable.

It also says you might need to disable or suspend BitLocker and Secure Boot before setting BCDEdit options.

What each nx value means

ValueMicrosoft’s description
OptInDEP only for operating system components, including the Windows kernel and drivers
OptOutDEP for the operating system and all processes, and administrators can exclude selected programs
AlwaysOnDEP for the operating system and all processes, and all attempts to disable it are ignored
AlwaysOffDEP is disabled, and attempts to enable it selectively are ignored

Microsoft’s DEP support-policy table lists OptIn as the default.

Turn DEP back on

  1. Open Command Prompt as administrator.
  2. Type bcdedit /set nx OptIn and press Enter.
  3. Restart the PC.

The BCDEdit page also says bcdedit /deletevalue nx removes a value you set.

To undo a single-program override, use the Remove command shown above, or switch the override off in Exploit protection.

If turning DEP off does not help

SituationWhat to know
The program is 64-bitExploit protection can only configure DEP for 32-bit apps
A work or school policy appliesGroup Policy changes override local exploit protection settings
The change did not applyRestart the process, the app or the PC as Windows asks
Hardware DEP will not changeMicrosoft says some systems let you disable it in the BIOS under a name such as NX or XD

If the PC no longer starts after a boot change, see our guide to fixing missing or corrupted boot configuration data.

To check for unwanted software before you lower any protection, run a Windows Security offline scan.

If a firewall rather than DEP is blocking a program, see how to block a program from the internet for the matching rule steps.

Official sources

Leave a Reply

Your email address will not be published. Required fields are marked *