Vous êtes sur la page 1sur 3

This tutorial is strictly for newbies.I am also one of them.....

:)
I created this tut as few people are subscribing me and I thank them....

Today we will discuss something about batch files . [PART-I]

Considering of Batch Files/Batch Scripts,one can perform various tasks in an


automated process.

One can create batch scritps for almost every task performed manually,just write
teh commands and there you go...

So why to waste time lets get going....

Remember I have considered that you have basic knowledge of DOS and you know some
basic commands of DOS,if not then just google DOS and
you will find all teh nessasary info you need... :)

So lets us start:->

Batch scripts perform automated process as I said earlier,Now a question may also
arise that why to use DOS and batch scripts when you can do all those things with
ease and
with GUI...

So heres teh answer ,if some steps are performed on daily basic and like you create
some files and want do delete them,shutting down your pc,ableing and disabling
firewalls and thousands of
basic and advanced process,which are only done through DOS can be arranged in a
batch script.

Basic before jumping to batch scripting:->

open your Command prompt by typing cmd in run box... :)

then change to your directory form yur system drive by typing the name of teh drive
like this :->

c:\Documents and Settings\Desktop\User>d:\ will change the driev to d:\> [only for
specific run],you can change to any other you want,its your wish which drive you
like.:)

Wow see you have changed your drive.

Now let us create a folder in this drive,it can be done by "md" command,

md stand sfor make directory,you can create a directory by using md command like
this :->

d:\md dos

this will create a folder named dos in d:\> drive ,Remember while using dos for
general pourpose it is not case sensitive.
So feel free to write in lower or upper or in which ever case you want :lol: :lol:

Okey

now you are doubting whether the folder is created or not,hmmmmm do'nt doubt and
check it yourself

this can be done by "dir" command,like this:->

d:\>dir

this shows the list of folders and loose files in drive d:\>

Do you see this <dir> in some places,ya they are teh folders in your drive.:)

It was easy huh......:lol:

Now try all teh command that you can you can find, teh list of commands over net or
simply type :->

d:\>help "and teh command name"

or you can use windows help and support,there is a vast set of commands in DOS and
almost every command is very powerful
in its own sphere....

Now are you eager for batch scripts,but listen carefully I am not going to take
your hand and walk you acroos the precipice
I am just going to show you teh way.........

Designing effective batch scripts depends on your imagnation and your


cappability,so dont stop learning as I am doing.

Your command prompt is open I think.:)

So type

d:\>edit first.bat

this will open the DOS editor under teh file name first.bat

now write

@echo Hello this is my first batch script


@echo this script will automatically create a folder named BScript on my d drive
d:
md BScript

[Now save teh file as ALT+F and then ALT+S,then exit by ALT+X] you can do it
through menu but this s shortcut,and comeon guys let us do through Command
Style :).

Now remember this not just teh way you can create batch files it can also be done
by copycon command,but we will do it like we have done it..:)
Now when ever you will run Bscript.bat it will create a folder named Bscript in d:\
> drive......

Batch Scripts are same as exe files,not in sense but as work.....:)

See now you do not have to go to d:\> drive and right click and then select new
folder and then name it,all this is just one click away,but batch scripts are not
used for these kinds of pourposes always
they are used for more important things,you will know them whenonce you will get
going....:)

when you run this script in DOS it will work nicely but when you run it in Windows
by doubleckicking it it will open and close in flash of a second..

huh what happend,let us see,just add a pause command after evry @echo command
like:->
@echo Hello this is my first batch script
@echo this script will automatically create a folder named BScript on my d drive
pause
d:
md Bscript

then again run in windows this pause command will now pause the screen and will ask
you to press any key before creating the folder.cool huh.
you just programmed a batch script.

Remember it will inform if a Bscript folder will alreadybe there so its nice to put
a pause after md Bscript,to see what the prompt window is saying :)

[This is just an example,I am again saying that batch scripts are really
powerful,and you can also use if staments in it]

Similarly you can do different things with these scripts..

Some concepts are not covered in this part but I will surely be covering them in
PART-II

Hope it helps you,happy coding and Happy hacking.[And my spellings are awfull,so
do'nt mind]

Regards,
vulPecula_TngH.

Vous aimerez peut-être aussi