09-02-2013, 10:58 AM
Batch File Programming
1Batch File .pdf (Size: 3.79 MB / Downloads: 84)
Introduction
Batch file programming is the native programming offered by the Microsoft Windows Operating
System. Batch file is created using any text editors like notepad, WordPad, WinWord or so on, which
comprises of a sequence of built-in commands used to perform some often done tasks like deleting a
series of files of same type or of different type, creating logs, clearing unwanted craps from your
computer and even for creating a batch VIRUS.
Whenever a Batch program is executed, it was interpreted line-by-line by the CLI (Command
Line Interpreter) command.com or the cmd.exe. Batch file is really helpful in automating tedious tasks
and for maintaining system logs. The commands used while creating a batch file are case insensitive, in
the sense that it may accept both small and upper case letters.
Interactive mode:
In interactive mode, when a command is executed, it interacts with the user for input and
depending upon the input supplied by the user, the further processes are carried out. For example, let’s
take the ‘del’ command.
The ‘del’ command is used for deleting files that reside inside a directory. Now I am going to
delete all the files inside a folder named ‘a’, and when I executed the following command, it is interacting
with me prompting “Are you sure (Y/N)?”, confirming the deletion operation, and depending upon my
input, it decides what to do. If I hit ‘Y’ then it will delete the files specified, else if I hit ‘N’ then it won’t
delete.
Internal Commands
Internal commands are nothing but the built-in commands that are shipped along with the
operating system, for example, echo, cls, del, dir were few of the well known internal commands.
External Commands
External commands are the commands that are often created while installing a new application
and these commands mostly have no use except calling that application and support files. Few external
commands can only be executed in the ‘Run’ dialog box (start Run), but not on the command prompt,
and those commands include ‘firefox’. The ‘firefox’ command can be executed only from the run line, that
too if the firefox application is installed on that machine and it won’t work on the command prompt.
Likewise the ‘firefox’ there are various other external commands such as the “PsTools” which includes
commands like, PsExec, PsFile, PsGetSid, PsInfo, PsKill, PsList, PsLoggedOn and so on.