Donate to our site if possible,,, so that we can develop it for you
Hello and welcome to this topic in which we will talk about one of the most important secrets of the Windows system, but before that and as some know, any system is characterized by its own command line, for example, we find on the Linux system Bash or what is called the Terminal, and we also find on The Windows system is a special command line, which is the CMD, which is the prompt or the command prompt for Microsoft systems, and we have previously talked about distinct tricks that you can do using the CMD command prompt in Windows. The role of these tools is as a link between the user and the computer, but after the emergence of graphic interfaces, the use of these tools has decreased greatly, but as much as graphic interfaces have been developed, the command prompt still retains its strength and many system administration professionals still use it extensively and beyond that. We find many users use it from time to time, as the Command Prompt enables you to do everything you need from advanced operations from executing non-graphical programs to modifying network settings to managing files more powerfully and also modifying parts of the system. Burn a copy of Windows on a flash memory through DOS, and of course, just as there is a language for scheduling commands in executable files on Linux called Shell script, there is also an important language on Windows which is Batch, so what is Batch? What are the most important uses? How can I learn this language?
– Definition in Batch language:
It is a procedural programming language based on various commands that are scheduled in a text file with a special extension which is .bat. These commands are executed inside this file in a sequential manner. Also, as programming languages, the Batch language contains various functions of conditions, repetition functions and other various algorithms that will help you It is based on building various software that enables you to perform most of the work that you will need, such as changing the state of a file if a certain condition is met on it, or checking the state of the system permanently through a recursion function or other things that this language allows you to do.
As for the commands, they are commands, most of which can be executed manually on CMD, but the need for Batch lies in executing files that contain several commands scheduled by the system administrator or the user to be executed at a specific time.
The most important uses of Batch:
Batch files can be scheduled to perform several actions or changes in the system, and as I mentioned earlier, it is one of the most tools that help the system administrator to do his work. Through it, he can, for example, program an applet based on taking a backup copy of important files in the system on an external medium and Here we mean an external hard disk or something else, and then the program disconnects it.
It should also be noted that this language also has a great positive aspect that there are those who use it in an illegal manner by producing various viruses by scheduling commands that sabotage the system or doing other advanced things in a dangerous way to produce what is called Batch Files Viruses. With regard to this part, and checking any file that ends in the .bat format, especially since these programs are widely spread on Arab and foreign forums and may come in the form of illegal crackers for programs or tools to perform tasks on the system.
And in order to understand Batch more, we will now program a simple script, and as the programming traditions state, we will program a script that prints “Hello World,” so follow the method:
First, we go to the start menu and search for Notepad and enter it, then we paste these codes:
ECHO Hello World
As shown in this image, we should get content like this:
– Then we do the process of saving the file, and the method of saving is also simple, which is to go to File Done, choose Save, then a window appears, we choose the place to save it on the desktop, as in the picture:
There is no problem in choosing any name that ends with .bat after that, and as in the picture, we go to the option Save as type and choose All Files
– Now we press Save to complete the saving process successfully. As for the commands that we put in the file, for ECHO OFF, we have given the system a signal to execute the commands and show the outside on the CMD.exe program. As for ECHO Hello World, it is a command to print “Hello World” and As for the last command, it is to show the end line, which suggests pressing any key to end the session, but now we execute the file by pressing it twice and we will find it on the desktop where we saved it:
And with this, we end the explanation. As for the references through which you can learn Batch, first you must develop your level in dealing with the command prompt or what is called CMD, and do not forget to follow us on the Computer World blog, where we will publish a supplement to this lesson to learn Batch, and thank you for Follow-up.