Monday, June 6, 2016

BATCH FILE TRICKS (PART I)



Batch files are simple files made using notepad, perhaps there are many files which can be made once you know about the command lines of windows. What we will discuss here is:
·         What are batch files?
·          How to make some virus using batch files and
·          How they work?
Batch file is a name given to a type of script file, text files containing a series of commands to be executed by command interpreter. A batch file contains any commands that can be executed and interpreted by the interpreter interactively at the command prompt (cmd). Batch files usually have extensions like *.bat which can be made through a serious of commands written in notepad or word pad.
Now to put it simple, a batch file is a text containing a sequence of commands, one in each line. When you launch batch file from the command line, command prompt reads the file executing each of the commands in sequence. Therefore using a batch file, you can automate tedious jobs or tasks that require typing several command sequence. For instance let’s say you have a daily task on your pc that needs to be done by writing about 5 lines of commands in order for your task to be accomplished, but you may make errors when writing this commands for every day, also you will kill your time writing the commands on your pc, this is the main reason why batch files are needed. Once you open the note pad you can simply insert the commands that you need, then save it as *.bat file which is very simple to do and also nobody wants to kill their time writing the same commands again and again every single day. Simply after creating our batch files we can launch them and they will do their magic.

How to make batch files?
Any text editor (an application that saves files as plain text files) will work to create batch files. The most popular application for creating batch files is the Microsoft Notepad utility included with Windows. Notepad has been included with every version of Windows since version 1.0 was released in 1985. (Which, I suspect, makes Notepad older and familiar with many of the readers of this tutorial!) Notepad is very bare bones, but it will make a clean text file for you to use as a batch file. You'll need to make sure you save it as a BAT file instead of a TXT file - go to the File menu, and then to Save As, change the "Save As Type" to "All Files", and type the file name with a BAT extension.

It's a bad idea to use a full-featured word processor like Microsoft Office Word or LibreOffice Writer to create your batch file. The standard save formats of full-featured word processors are obviously not text files, and even when saving a Word document as a TXT file, it tends to be formatted incorrectly. If you want a more full-featured text editor, there are several free programs available - Notepad++ is one of the more popular ones.


BATCH COMMANDS

You can put practically any command in a batch file. There are, however, a set of ten commands that are particularly useful for adding functionality to batch files (and some of them only work properly when used in a batch file). Using them, you can create limited programs that accept user input, complete with assigned variables. These will be simple programs - to create really complex effects, you'd need to learn WMI (Windows Management Instrumentation) syntax or a programming language like C# or Visual Basic. Nevertheless, you can use these commands to create useful batch files.

The ten batch file commands are ECHO, CALL, FOR, PAUSE, CHOICE, GOTO, REM, IF, SHIFT, SET. Now, what we covered in this tutorial is just a general knowledge which will help get introduced about batch files.

I hope this tutorial has helped you understand what batch files are needed for!!




No comments:

Post a Comment