How to fix VSCode .exe file blocked by Windows Application Control Policy

Krishna Sharma 0 Reputation points
2026-11-18T18:54:36.76+00:00

Please help my windows security keeps blocking my .c and .cpp executable 1 out of 20 tries and its annoying when testing code. The message it displays on terminal is as: Program '21lab.exe' failed to run: An Application Control policy has blocked this fileAt line:1 char:64

  • ... "e:\OOPS" ; if ($?) { g++ mLlab.cpp -o mLlab } ; if ($?) { .\mLlab }
  •                                                             ~~~~~~~.
    

At line:1 char:64

  • ... "e:\OOPS" ; if ($?) { g++ mLlab.cpp -o mLlab } ; if ($?) { .\mLlab }
  •                                                             ~~~~~~~
    
    • CategoryInfo : ResourceUnavailable: (:) [], ApplicationFailedException
    • FullyQualifiedErrorId : NativeCommandFailed

Also I tried following the below mentioned procedure and even creating a Developer Disk Still the Same problem persists.

1, Check Windows Security Protection History.

  • Open Windows Security.
  • Select Virus & threat protection.
  • Open Protection history.
  • Check whether Windows Defender Antivirus or another security component has quarantined or blocked the executable.

2, Check Microsoft Defender Antivirus detection details.

  • Look for the detection name and affected file.
  • If the file was quarantined, verify that it is your own compiled executable before considering any restore action.

3, Verify the executable’s location and build output.

  • Confirm that VS Code is launching the latest compiled version.
  • Check whether your build process generates the executable in a different directory or overwrites an existing file., Check Windows Security Protection History.
    • Open Windows Security.
    • Select Virus & threat protection.
    • Open Protection history.
    • Check whether Windows Defender Antivirus or another security component has quarantined or blocked the executable.
    2, Check Microsoft Defender Antivirus detection details.
    • Look for the detection name and affected file.
    • If the file was quarantined, verify that it is your own compiled executable before considering any restore action.
    3, Verify the executable’s location and build output.
    • Confirm that VS Code is launching the latest compiled version.
    • Check whether your build process generates the executable in a different directory or overwrites an existing file.

Even After using this procedure and creating even a developer disk problem is there . Pleaseee Helppp

Windows for home | Windows 11 | Security and privacy
0 comments No comments

1 answer

Sort by: Oldest
  1. Allan Solomon Mejia 11,145 Reputation points
    2026-11-18T19:29:55.84+00:00

    Hi @Krishna Sharma

    The error is an Application Control enforcement block, not a VS Code, PowerShell, GCC, or file-association failure. Creating a Developer Drive doesn’t automatically create an App Control exception for executables compiled on that drive.

    First, identify which policy is blocking the executable:

    1. Open Event Viewer.
    2. Navigate to Applications and Services Logs > Microsoft > Windows > CodeIntegrity > Operational.
    3. Rebuild and run the program until the block occurs.
    4. Find the corresponding events:
      • 3077 - an enforced App Control policy blocked the executable.
      • 3089 - signature information associated with the blocked file.
      • 3099 - identifies a successfully loaded App Control policy.

    Record the PolicyName, PolicyId, File Name, Process Name, and signing information.

    You can also list the App Control policies from an elevated terminal:

    CiTool.exe --list-policies
    

    CiTool is included in Windows 11 version 22H2 and later. Do not remove a policy until you know whether it belongs to Windows, Smart App Control, or an organization managing the device.

    If Smart App Control is responsible

    Check Windows Security > App & browser control > Smart App Control settings. Smart App Control can block newly compiled, unsigned executables when Microsoft’s reputation service can’t confidently classify them as safe. Microsoft doesn’t provide per-application exceptions for Smart App Control. The supported options are to sign the executable with a valid trusted certificate or turn off Smart App Control. Turning it off reduces protection against unknown or unsigned applications.

    For repeatedly rebuilt local development binaries, signing each production version may be appropriate, but Microsoft doesn’t document a Smart App Control exception specifically for temporary GCC build output.

    If an App Control for Business policy is responsible

    If Event 3077 identifies an organizational policy or Windows reports that an organization manages settings, the policy administrator must review the 3077/3089 events and add an appropriate allow rule or supplemental policy. App Control rules can use signer, file metadata, hash, managed installer, reputation, path, or launching-process criteria.

    A hash rule is usually unsuitable for development output because recompiling changes the binary. That recommendation is an inference from Microsoft’s documented rule types; the appropriate rule must be selected by whoever owns the policy.

    References:


    Help make this community better for everyone: If this answer helped or resolved your issue, please accept it or upvote it. If not, share more details in a comment so we can continue the discussion and find the right solution. Thank you.

    Was this answer helpful?

    2 people found this answer helpful.

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.