An executable file is a type of computer file that runs a program when it is opened. This means it executes code or a series of instructions contained in the file. The two primary types of executable files are 1) compiled programs and 2) scripts.
On Windows systems, compiled programs have an .EXE file extension and are often referred to as "EXE files." On Macintosh computers, compiled programs have an .APP extension, which is short for application. Both types of executable files have been compiled from source code into binary machine code that is directly executable by the CPU. However, EXE files only run in Windows, while APP files only run in Mac OS X. This is because the code is executed by the operating system and therefore must be compiled in format that the operating system can understand.
Uncompiled executable files are often referred to as scripts. These files are saved in a plain text format, rather than a binary format. In other words, you can open a script file and view the code in a text editor. Since scripts do not contain executable machine code, they require an interpreter to run. For example, a PHP file can execute code only when run through a PHP interpreter. If a PHP interpreter is not available, the PHP script can only be opened as a text file.
Since executable files run code when opened, you should not open unknown executable files, especially ones received as email attachments. While compiled executable files are the most dangerous, script files can run malicious code as well. For example, VBScript (.VBS) files can run automatically on Windows systems through the built-in Windows Script Host. Likewise, AppleScript (.SCPT) files can run through the AppleScript interpreter included with Mac OS X. Therefore, if you come across an unknown file and are unsure if it contains executable code, it is best not to open it. Below is a list of common file extensions used for executable files on Windows and Macintosh systems.