How to Enable or Disable Enhanced Security and Performance for Batch and CMD Files in Windows 11

Batch (.bat) and Command (.cmd) files are commonly used in Windows for automation, scripting, software deployment, and administrative tasks. In Windows 11, Microsoft includes additional security and performance protections that affect how these scripts are executed, especially when they originate from unknown or downloaded sources.

These protections help reduce the risk of malicious scripts by applying reputation checks, execution restrictions, and security scanning. However, in some cases, advanced users and administrators may want to disable certain protections for compatibility, automation workflows, or performance reasons.

In this guide, we’ll walk you through how to enable or disable enhanced security and performance settings for Batch and CMD files in Windows 11.

How to Enable or Disable Enhanced Security and Performance for Batch and CMD Files

Before applying the methods below, remember that reducing security protections can increase the risk of running harmful scripts. Only make these changes if you trust the script source completely.

1. Unblock Batch or CMD Files Downloaded from the Internet

Windows may automatically block downloaded scripts.

  1. Right-click the .bat or .cmd file.
  2. Select Properties.
  3. In the General tab, look for the message:This file came from another computer and might be blocked
  4. Check Unblock.
  5. Click Apply and OK.

This removes the security block from the script file.

2. Run Scripts as Administrator

Some scripts require elevated privileges for full functionality.

  1. Right-click the batch or CMD file.
  2. Select Run as administrator.

This allows the script to execute with higher system permissions.

3. Configure SmartScreen Protection

Windows SmartScreen may warn or block scripts.

  1. Press Windows + I to open Settings.
  2. Go to Privacy & Security > Windows Security.
  3. Open App & browser control.
  4. Click Reputation-based protection settings.
  5. Adjust SmartScreen options depending on your needs.

Disabling SmartScreen reduces warnings but also lowers security protection.

4. Enable or Disable Command Prompt Access via Group Policy

Administrators can control CMD access using Group Policy.

  1. Press Windows + R, type:gpedit.msc
  2. Press Enter.
  3. Navigate to:User Configuration > Administrative Templates > System
  4. Open:Prevent access to the command prompt
  5. Set it to:
    • Enabled to block CMD and batch execution
    • Disabled or Not Configured to allow it

This centrally manages CMD availability.

5. Configure PowerShell Execution Policy (If Scripts Use PowerShell)

Some batch files internally launch PowerShell commands.

  1. Open Windows Terminal (Admin).
  2. Run:Get-ExecutionPolicy
  3. To allow locally created scripts, run:Set-ExecutionPolicy RemoteSigned
  4. Confirm the change.

This allows trusted scripts while maintaining some security protections.

6. Disable Controlled Folder Access (Optional)

Windows Defender ransomware protection may interfere with scripts.

  1. Open Windows Security.
  2. Go to Virus & threat protection.
  3. Click Manage ransomware protection.
  4. Disable Controlled folder access temporarily if necessary.

Only disable this feature for trusted environments.

7. Add Script Exceptions in Antivirus Software

Antivirus scanning can slow down or block script execution.

  1. Open your antivirus or Windows Security.
  2. Navigate to Exclusions.
  3. Add the trusted .bat or .cmd file as an exclusion.

This can improve script performance and reduce false positives.

8. Enable Long Path Support

Some advanced scripts may fail because of Windows path length limits.

  1. Press Windows + R, type:regedit
  2. Navigate to:HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem
  3. Double-click:LongPathsEnabled
  4. Set the value to:1
  5. Restart your PC.

This improves compatibility with complex automation scripts.

9. Use Windows Terminal for Better Performance

Modern terminals provide improved compatibility and rendering.

  1. Open Windows Terminal.
  2. Run your batch or CMD scripts inside it.

Windows Terminal offers better performance and modern features compared to the legacy Command Prompt.

Conclusion

Enhanced security and performance protections for batch and CMD files in Windows 11 help protect your system from malicious scripts and unauthorized execution. However, trusted automation workflows may require certain restrictions to be adjusted for compatibility and smoother execution.

By following the methods in this guide—from managing SmartScreen and Group Policy to configuring PowerShell and antivirus exclusions—you can control how batch and CMD files behave while maintaining the right balance between security and performance.

Posted by Raj Bepari

I’m a digital content creator passionate about everything tech.