How to create a BAT file in Windows 10

Anonim

How to create a BAT file in Windows 10

Bat - batch files containing commands for automating certain actions in Windows. It can start one or several times depending on its content. The content of the "Batnik" user defines independently - in any case, it must be text commands that support DOS. In this article, we will consider creating such a file in different ways.

Creating a BAT file in Windows 10

In any version, Windows Windows can create batch files and use them to work with applications, documents or other data. Third-party programs are not needed for this, since Windows and itself provides all the possibilities for this.

Be careful trying to create a BAT with an unknown and incomprehensible content for you. Such files can harm your PC, running the virus, extortioner or encrypter on the computer. If you do not understand which commands are the code, first find out their value.

Method 1: Notepad

Through the classic Notepad application, you can easily create and fill the BAT the necessary set of commands.

Option 1: Launch notepad

This option is the most common, so consider it first.

  1. Through the "Start", run the built-in Windows "Notepad".
  2. Starting a notebook application via Start in Windows 10

  3. Enter the desired lines by checking their correctness.
  4. The process of creating a BAT file through a notebook in Windows 10

  5. Click on "File"> "Save As".
  6. Saving a BAT file via Notepad in Windows 10

  7. At first, select the directory where the file will be stored, in the "File Name" field, instead of an asterisk, enter the appropriate name, and the extension runs after the point, change the .txt to .bat. In the File Type field, select "All Files" and click "Save".
  8. BAT file saving options in Windows 10

  9. If there are Russian letters in the text, the encoding when creating a file should be "ANSI". Otherwise, instead of them on the command prompt, you will receive a unreadable text.
  10. Select encoding while saving a BAT file in Windows 10

  11. Batnik can be launched as a regular file. If in the content there are no commands that interact with the user, the command line will appear for a second. Otherwise, its window will start with questions or other actions requiring an answer from the user.
  12. An example of a BAT file created in Windows 10

Option 2: Context menu

  1. You can also immediately open the directory where you plan to save the file, click on the empty location with the right mouse button, to "create" to "create" and select "Text Document" from the list.
  2. Creating a text document through the context menu in Windows 10

  3. Specify it with the desired name and change the extension going after the point, with .txt on .bat.
  4. Renaming the document and its expansion in BAT in Windows 10

  5. Bill may be a warning about changing the file expansion. Agree with him.
  6. Confirmation of changing the permission of the created text document in Windows 10

  7. Click on the PCM file and select Edit.
  8. Changing the BAT file through the context menu in Windows 10

  9. The file will open in the notepad empty, and there you can fill it at your discretion.
  10. Amendments to the created BAT file in Windows 10

  11. After completing, through the "Start"> "Save", make all changes. For the same purpose, you can use the CTRL + S key combination.
  12. Re-save the BAT file in Windows 10

If you have NotePad ++ on your computer, it is better to use it. This application highlights syntax, allowing you to easily work with the creation of a set of commands. On the top panel there is an opportunity to choose an encoding with support for Cyrillic ("encoding"> "Cyrillic"> "OEM 866"), since the standard ANSI in some continues to display the cracks instead of normal letters entered on the Russian layout.

Method 2: Command String

Through the console without any problems, you can create an empty or filled Bat, which in the future through it will also be launched.

  1. Open the command line in any convenient way, for example, through the "Start", on the search for its name.
  2. Running CMD through Start in Windows 10

  3. Enter the COPY CON C: \ Lumpics_ru.Bat command, where Copy CON is a command that will create a text document, C: \ File Save Directory, Lumpics_RU - File Name, and .bat - Expansion of a text document.
  4. Creating a BAT file via the command line in Windows 10

  5. You will see that the flashing cursor moved to the line below - here you can enter text. You can save and empty file, and to learn how to do it, move to the next step. However, usually users immediately introduce the necessary commands there.

    If you are manually inserted, go to each new line with a Ctrl + Enter key combination. If there is a pre-harvested and copied set of commands, simply click right-click on an empty place and what is in the exchange buffer will be inserted automatically.

  6. Enter commands for the created BAT file via the command line in Windows 10

  7. To save the file, use the Ctrl + Z key combination and press ENTER. Their pressing will appear in the console as shown in the screenshot below - this is normal. In the Batnik itself, these two characters will not appear.
  8. Enter commands for the created BAT file via the command line in Windows 10

  9. If everything has passed successfully, you will see a notification at the command prompt.
  10. Confirmation of saving the created BAT file via the command line in Windows 10

  11. To check the correctness of the created file, start it as any other executable file.
  12. Created BAT file via the command line in Windows 10

Do not forget that at any moment you can edit the batch file by clicking on them with the right mouse button and selecting "Edit" item, and press Ctrl + S.

Read more