What is batch file programmimg? Explain five commands with syntax?
Answers
Answer:
In this tutorial, you will learn about batch file commands and how they are used in batch file scripting or programming.
batch file command
As discussed in the previous tutorial, a batch file is an unformatted text file or script file which contains multiple batch file commands or instructions to achieve a certain task. It has extension of .bat or .cmd Batch file commands: Windows/DOS
For the ease of learning, we have listed all the batch file commands with relevant examples and explanations below. Please click on the commands to know the details. Note: Batch file commands are not case sensitive
ASSOC
The batch command ASSOC associates a file extension with a file type, or list all associations.
Example
@echo OFF
ASSOC | find ".txt"
pause
Output
.txt = textfile
As shown in above output, it displays the file association for .txt extension.
If only ASSOC is written and executed, it will display all the file associations for every extension, instead of just .txt extension.
click here to go back to list of commands
ATTRIB
The batch command ATTRIB is used to display the file attributes or set an attribute to a file in the working directory.
Example
Now let us suppose we have a file note.txt in our working directory. We will display its file attributes and then make it hidden and read only by adding 'ah' and 'r' attributes to it. And finally, we will remove some attributes we added as well.
✌✌✌✌✌✌✌✌✌✌✌✌✌✌✌✌
Explanation:
✔✔ Hello mate ✔✔
Here's your answer
When a batch file is run, the shell program (usually COMMAND or reads the file and executes its commands, normally line-by-line. Unix-like operating systems, such as Linux, have a similar, but more flexible, type of file called a shell script. The filename extension .bat is used in DOS and Windows.
¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
Hope it helps you