Hide Comments

A batch file can run in two different modes. In the first, traditional mode, each line of the batch file is read and executed individually, and the file is opened and closed to read each line. In the second mode the batch file is opened once, the entire file is read into memory, and the file is closed. Only the first mode can be used for self-modifying batch files (which are rare).

 

The batch file's extension determines its initial mode. Files with a .BAT or .CMD extension are run in the first mode. Files with a .BTM extension are run in the more efficient second mode. You can change the execution mode inside a batch file with the LOADBTM command.