What is the difference between .BAT and .EXE files?
Batch files are really just text files, or small scripts which can be executed by command line processor - "cmd.exe", they where widely used in DOS environment for automation of common tasks.
EXE files are different from BAT files since they contain executable binary data rather than plain text commands. They are stored in the Portable Executable (PE) format. The EXE file format includes various headers and sections that tell Windows how to run a program. Some portions of an EXE file may contain program code while others may contain resource data.
What the limitation of bat to exe conversion?
- After compilation batch script become a binary file, so you not longer use any text from it. For example, you can not use "type %0" command to show batch source.
- All batch scripts executed by a single system process "cmd.exe", so they can exchange environment variables. Every EXE file executed in separate system process and this exchange not allowed. You can only use return code.