It looks like all EXE files begin with MZ when they are opened in ASCII mode, is there an ASCII identified for vbs, com and bat files as well? i can’t seem to find a pattern…
Or maybe there’s another way to identify them? aside from just the extension…
No, not really (Windows executables can have PE or PK at the beginning instead of MZ – see this for other possible formats).
For other types of files, there are certain heuristics you can use (e.g. GIF files start with “GIF89”, Bash shell scripts usually start with
#!/bin/bash, BAT files often execute@echo offat the beginning, VBS scripts use apostrophe at the start of line as a comment marker), but they aren’t always 100% reliable (a file can be both a BAT script and a Bash shell script; or a file that’s both a valid ZIP archive and a valid GIF image (like that stegosaurus image), for example).See e.g. this article for further reading.