How To Write A Batch File

Table of contents:

How To Write A Batch File
How To Write A Batch File

Video: How To Write A Batch File

Video: How To Write A Batch File
Video: How to Write a Simple Batch File in Windows 2024, May
Anonim

Technical writers (programmers) often use batch files. With their help, it becomes possible to automatically perform the same tasks, since a specialist can waste a lot of time.

How to write a batch file
How to write a batch file

Instructions

Step 1

The command line originates from the even older operating system MS-DOS. Even today, when visually designed systems go by leaps and bounds, you can find the effect of the presence of text input of commands through the command line. Some users consider the MS-DOS system an throwback, but this is not at all the case.

Step 2

To launch the command line, you must click the "Start" menu and select the "Run" item, or press the Win + R key combination. In the window that opens, go to the empty field and enter the cmd command, then click the "OK" button or the Enter key.

Step 3

You will see a command prompt window, colored black. Please note that all actions that you write in the batch file to be launched in bat format will be completed through this utility. Inside this file, you must write the required commands and add values to them.

Step 4

To create a simple batch file, you need to follow the procedure for creating a standard text document. Right-click on a free space in the workspace of any directory or desktop and select the "Create" section, then click on the "Text file" item. Change the name of the document to File.bat. Right-click on it and select "Open with", in the window that appears, select any text editor.

Step 5

To see a list of all available command line commands, run the program, type help, and press Enter. Frequently encountered commands include MD, CD, etc. The MD command is used to create a directory. This acronym is an abbreviation for Make Directory. With the CD command, you can navigate the directories of the selected disc.

Step 6

As an example, you can use the rather simple MD command D: System dirname. Save the file by pressing the Ctrl + S keyboard shortcut and run it. Navigate to drive D, then open the System directory and view a list of all folders. If the folder specified in the bat-file exists, the sequence of actions was followed in the correct order.

Recommended: