0

Every time I try to open some of my own .BAT files in Notepad++ (just to edit it, not to even run the batch file), I get the "Windows protected your PC" ... "prevented an unrecognized app from starting".

Protected your PC

(This happens when I right-click "Edit" on the .BAT file in File Explorer. I have setup the registry to associate ".bat" and the action "Edit" with Notepad++.)

I can edit them OK if I click "More info>Run anyway", but I don't want to have to do this at all on my own files.

Clearly I have something configured wrong, but what?

Here's an example of a file it happens on:

General Security Details

I'm user "Dave", and I have admin privs.

As a developer I should be able to at least edit text files with NP++ without getting this popup all the time. And run/test my own code.

But I don't want to disable Windows Defender generally (I do worry about attacks), or have to setup a special config for every single build of every app I work on.

How?

===========

Added in response to comments:

This only happens the FIRST time I try to open the .BAT with Right-Click "Edit".

I'm creating the batch file by copying and renaming an existing batch file (that opens OK, but which had the same behavior when first created the same way).

If, after creating the file that way (copy), I do RightClick "Edit", I get the UAC pop-up. I will get that each time I try to edit that way, until I do More Info>Run anyway. After that, it opens without a popup.

If, after creating the file that way (copy), I do RightClick "Edit with Notepad++", I don't get the UAC pop-up (but still will if I try "Edit").

If I check the "Unblock" box in Properties, then it opens OK either way, without the popup.

Toto
  • 17,001
  • 56
  • 30
  • 41
nerdfever.com
  • 167
  • 1
  • 9
  • *"I don't want to (...) setup a special config for every single build of every app I work on"* but perhaps you should? – ChanganAuto Oct 12 '22 at 18:10
  • Something is certainly wrong. I myself do what you are doing every single day with no such restriction. I myself didn't mess with the association. I use the "Edit with notepad++" option the installer added. I doubt that is the problem.. I have added 100 other custom associations and don't get the warning. Is .BAT still in your PATHEXT environment? What happens if it is a .CMD file? What happens if you use the same context item I do "Edit with notepad++"? – Señor CMasMas Oct 12 '22 at 18:15
  • What happens if you check this and click apply? https://i.stack.imgur.com/23MAR.png – Mokubai Oct 12 '22 at 18:16
  • Please see additional details I just added (at the end of the question). – nerdfever.com Oct 12 '22 at 18:26
  • @SeñorCMasMas Yes, .BAT is still in PATHEXT. Same thing happens with .CMD files. – nerdfever.com Oct 12 '22 at 18:33
  • Apparenlty a powershell script can list and unblock all scripts in a directory: https://superuser.com/a/422432/19943 the other answers on that post also list many other options that would allow clearing the Zone.Identifier file stream where this is being blocked. – Mokubai Oct 12 '22 at 18:44
  • It's important to understand that `Microsoft Defender Smartscreen` != `Windows Defender` those two security features have little to do with one another. Smartscreen will block a file based on it's reputation, precisely, a lack of reputation. There are way to prevent this dialog, one of those ways, is to unblock the file. Smartscreen dialog will happen regardless of your permissions, so there isn't anything wrong, the correct action is to allow the application. The reason for the dialog likely has something to do with Notepadd++ or it's the Zone.Identifier – Ramhound Oct 12 '22 at 18:45

0 Answers0