Self-defense Avast is good, but not 100%. A bat-file - it’s trouble many AB. The advantage is that the detective Avast can find many bat files but block the malware, not a detective who can not, there’s so powerful HIPS, which would allow it to do so. https://www.youtube.com/watch?v=1rYBUoSY478
This has nothing to do with BAT files - he’s terminated the antivirus process(es) with a special tool first, so of course it didn’t detect the file later (when it wasn’t running).
The self-defense tries to do its best, but this tool uses drivers (which means you need to be an administrator to run it), and there will always be ways to bypass the self-defense with drivers, there’s nothing you can really do about that (be it Avast or any other antivirus). [Sure, you can probably update the self-defense for this particular tool, or even block its execution and not allow to start it at all - but there will always be other ways.]
So the actual lesson is - do not use your machine logged on as an administrator. It’s dangerous and there’s no (reliable) help for you if you do that.
I have been “shouting” for years not to use a account with administrator rights for daily use unless it is really needed to do something.
But users refuse to listen
A little something a wrote 8(!) years ago > http://malware.ache.nl/securitysetup.php