ComputersFile Types

Ways to create a bat file

The ability to use command batch files with the bat extension, also known as batch files, first appeared in the first versions of the MS-DOS system. Then these files migrated to the new Windows and OS / 2 systems. A user who knows how to make a bat-file has the ability to simplify its operation several times in the operating system. For the sake of justice it is worth noting that you can do without the bats. But often it is still necessary to study some features of the execution of commands by the system. Therefore, it makes no sense to ignore the possibility and it's better to study the question of how to create a bat-file.

The structure of the batch file is very simple: it is actually a text file familiar to everyone, in which commands for execution by the command processor (interpreter) are consistently written. In DOS it was command.com, and in new systems it was replaced by cmd.exe.

Implemented extended support for the if, for, goto (remember BASIC and algorithm algorithms), which allows you to create a simple interactive menu. In the last years of MS-DOS life (before the victorious procession of Windows) enthusiasts created quite complex branched files autoexec.bat.

Expansion of bat-batch files is accepted in the first Microsoft systems, while modern batch files are cmd-files with additional functions.

The main purpose of bat-files is to automate the execution of simple commands, "understood" by the interpreter. For example, by running a correctly compiled batch file, you can automatically delete the entire directory, create a folder, copy and archive files. These are just the basic functions that most people understand. In fact, the possibilities are much broader. Often the forums give tips on how to create a file with the bat extension, which allows you to check the quality of the connection to the Internet. This is especially useful for fans of online battles, where the speed of the connection is not important, but the ping (delay in the transmission of data packets). For example, in a game, several servers are used, and the user wants to select the fastest one. Knowing their IP addresses, you can create a batch file and check the ping, then choosing the best one. The batch file commands will look like this:

Ping ХХХ.ХХХ.ХХХ.ХХ

Pause,

Where "ХХХ ..." is the address of the resource being checked. Using the usual method and typing "Start - Run - Ping XXX ...", the result is that you can not understand anything, because after the test, the window with the results will close instantly. And the pause command in the batch file prevents the window from closing. Of course, this is a simple example, but it gives an idea of the benefits of bat-files.

There are several ways to create a bat-file, and they are all effective. Working with files is most convenient from the shell program FAR or Total Commander (TC). The best built-in conductor is still inferior to the capabilities of shells. In such shells, there are no difficulties with how to create a bat-file. In TC, press Shift + F4 and type the file name according to the standard "name.extension", for example, test.bat. A notebook opens. We write the necessary commands. On exit, we save the changes. Everything, the batik is created.

Devotees of standard utilities should first run a notepad: Win + R, in the appeared window type notepad (Enter). We type the commands of the batch file. In the "save as" menu, select the path to save, and in the "filename" box write the standard - "name.expansion" (test.bat). The file was created. The main thing - do not forget to prescribe an extension.

Similarly, you can create a batch file even from the MS Word application. Just do not forget to specify the required file extension.

A novice who decided to learn how to create a bat file should always remember that no one has canceled the rules for creating files yet, but they say that each file must have an extension (three letters after the dot). The extension tells the operating system which application to open this file. "Bat" is an extension.

Similar articles

 

 

 

 

Trending Now

 

 

 

 

Newest

Copyright © 2018 en.delachieve.com. Theme powered by WordPress.