Home  >  Article  >  What is the extension of a disk file that can be loaded into memory by keyboard commands and executed directly?

What is the extension of a disk file that can be loaded into memory by keyboard commands and executed directly?

青灯夜游
青灯夜游Original
2022-07-15 15:59:014270browse

The extension is ".EXE" or ".COM". ".EXE" and ".COM" are two types of binary executable files. EXE files can be loaded into memory and loaded and executed by the operating system; COM is used as the extension of a text file containing commands supported by the operating system. COM files It does not come with any supporting data and only contains executable code. The file header is the first execution instruction.

What is the extension of a disk file that can be loaded into memory by keyboard commands and executed directly?

The operating environment of this tutorial: Windows 7 system, Dell G3 computer.

The extension of a disk file that can be loaded into memory by keyboard commands and executed directly is ".EXE" or ".COM". They are binary executable files in the windows operating system.

Extension EXE

The extension ".EXE" is an executable program, which is a binary executable program that can be floated in the operating system storage space. It can be loaded into memory, loaded and executed by the operating system. Executable programs between different platforms corresponding to a specific CPU instruction set (such as the X86 instruction set) cannot be directly transplanted and run.

EXE files are divided into two parts: EXE file header and program body. The exe file is relatively complex and has a multi-segment structure. It is one of the most successful and complex designs of DOS. Each exe file contains a file header and an image of a relocatable program. The file header contains information used by MS-DOS to load the program, such as the program's size and initial values ​​for registers. The file header also points to a relocation table, which contains a linked list of pointers to the addresses of relocatable segments in the program image. MS-DOS loads the exe program by copying the image directly from the file into memory, and then adjusts the relocatable segment address specified in the location table. The location table is an array of relocation pointers, each pointing to a relocatable segment address in the program image.

Extension COM

COM format file is a simple executable file. In the operating system launched by Digito in the 1970s, .COM was used as the extension for text files containing commands supported by the operating system (similar to .cmd files in Windows systems). With the introduction of CP/M (an operating system for microcomputers), files with COM extensions were changed into executable files. The format was later carried over to MS-DOS. Although MS-DOS has had the more common .exe file format, compact COM files have remained alive and frequently used in MS-DOS.

The COM file does not come with any supporting data and only contains executable code. The file header is the first execution instruction. There is no relocation information, so the code cannot have instructions that operate data across memory segments (segments), so the code and data can only be limited to the same 64KB memory segment.

Windows NT-based operating systems use the .com extension to handle a small number of commands transferred from MS-DOS time, although they are actually currently implemented as .exe files. The operating system will recognize the .exe file headers and execute them correctly despite their technically incorrect .com extension. (In fact, any .exe file can be renamed .com and still execute correctly.) Using the original .com extension for these commands ensures compatibility with older MS-DOS batch files, which may use the full original file Reference them by name. These commands are chcp.com, discomp.com, diskcopy.com, format.com, mode.com, more.com and tree.com.

Extended knowledge:

There are two types of binary executable files in the windows operating system: one has the suffix .COM, and the other has .EXE.

Under MS-DOS, when there are .EXE files and .COM files with the same name when running, the .COM file will be executed first. If you only have A.EXE, you can enter "A" directly instead of entering the full name. But if there are A.COM and A.EXE, if you enter A, A.COM will be executed first. To run A.EXE, you can only enter A.EXE but not A.

Executable files in WINDOWS systems are generally .EXE files. In Windows, the user enters the file name without the .exe extension at the command prompt and presses the Enter key or double-clicks to run the executable program.

Linux does not rely on file extensions to determine whether it is executable like MS-DOS/windows, but on file attributes. Each file has a dedicated attribute to indicate whether the file is executable. For programs such as scripts, the first line of the file indicates the location of the program that executes the script.

For more related knowledge, please visit the FAQ column!

The above is the detailed content of What is the extension of a disk file that can be loaded into memory by keyboard commands and executed directly?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn