Batch

                                          Batch files:

These type of files are ever so easy to understand,once you'v got the commands sorted out! In this little text book it will teach you all the basics and much more!!! But first you want to know a little bit more about them, Well the Autoexec.bat file is very usefull because it checks that you have certain things installed on your computer. A warning, Do not ever touch or modify the file because it may cause your computer to lockup(Never be able to turn it back on)or it may not be able to run windows!!!

Now less with the talking and more with the commands!!!

Right these simple commands are easy to understand:

It will also have an explanation after it aswell:

Short Explanation

@echo off = Turns echo off

cls = Clears the screen

pause = Press any key to continue .   .   .

cls

echo (Put your Text here) dont include the brackets!!!

choice /c:yn = Gives user a choice of what to do.

if errorlevel 2 goto (label) = you have to put this here because it gives the choice command a place to go.

if errorlevel 1 goto (label) =These two, 1 stands for Y and 2 stands for N or whatever you put in the choice command! You can have as many as you want errorlevels and choice's

:(label) = add colon before label so errorlevels know where they are going! Dont include the brackets!

 echo (Text)

pause

cls

exit = exit's

:(label)

echo (Text)

pause

cls

exit

Thats it for the basic commands!!!

Little more advanced:

You can add these commands to your batch file!

REM (TEXT) = dosent display the text in the program only in the notepad bit.

copy (string) (string) = copys a file from one place to another.

mkdir (Text) (String)  = makes a directory in a certain path.

or you colud use MD

Rename (file) (to what) = Renames a file to something else.

if exists (Path as string) (command) = makes program find something and if it does it does the command.

if not exist (path as string) (command) = does the same as the one above

You can find these out for yourself!

A ANSI.SYS | ARP | ATTRIB

B BREAK

C CD | CHCP | CHDIR | CHKDSK | CHOICE | CLS | COMMAND | COPY | CTTY

D DATE | DEBUG | DEL | DELTREE | DIR | DISKCOPY | DOSKEY | DOSSHELL | DRIVPARM

E ECHO | EDIT | EDLIN | EMM386 | ERASE | EXIT | EXPAND | EXTRACT

F FASTHELP | FC | FDISK | FIND | FOR | FORMAT | FTP

G NONE

H HELP

I IFSHLP.SYS | IPCONFIG

J NONE

K KEYB

L LABEL | LH | LOADFIX | LOADHIGH

M MD | MEM | MKDIR | MODE | MORE | MOVE | MSAV | MSD | MSCDEX

N NET | NLSFUNC

O NONE

P PATH | PAUSE | PING | POWER | PROMPT

Q QBASIC

R RD | REN | RENAME | RMDIR | ROUTE

S SCANREG | SET | SETVER | SHARE | SORT | SUBST | SWITCHES | SYS

T TIME | TRACERT | TREE | TYPE

U UNDELETE | UNFORMAT

V VER | VERIFY | VOL

W NONE

X XCOPY

Y NONE

Z NONE

ping (website) = connects to a website! dont add the brackets!

goto (label) = goes to a label with a colon in front of it! dont add the brackets!

TYPE NUL | CHOICE.COM /N /CY /TY,0>NUL = where 0 is put a number from 1-99 and it will wait for that ammount of time in seconds!

start (String as path) = runs the program in the brackets! Dont add the brackets!!!

echo (TEXT) >(Filename) = sends text to a certain file!

copy con (file) >nul =creates a console so you can type anything you want in the file, after you have finished typing press F6 and it will either do the command if you put it in an errorlevel and it sends the text that you have wrote to the file!

If you have downloaded any *.exe files for dos programs then you can use them in it aswell!

You can use either of the following commands in a batch file to restart Windows 98/Me automatically:

runonce.exe -q

rundll32.exe shell32.dll,SHExitWindowsEx n

where n is one, or a combination of, the following numbers:

0 - LOGOFF

1 - SHUTDOWN

2 - REBOOT

4 - FORCE

8 - POWEROFF

The above options can be combined into one value to achieve different results. For example, to restart Windows forcefully, without querying any running programs, use the following command line:

rundll32.exe shell32.dll,SHExitWindowsEx 6

NOTE: Using the FORCE option can cause programs to lose data.

Below is an explanation of each available option used with the above command line:

LOGOFF - Shuts down all running processes, then logs the user off.

POWEROFF - Shuts down the system and turns off the power. The system must support the power-off feature.

REBOOT - Shuts down the system and then restarts the system.

SHUTDOWN - Shuts down the system to a point at which it is safe to turn off the power. All file buffers have been flushed to disk, and all running processes have stopped.

FORCE - Forces processes to terminate. When this flag is set, Windows does not query running applications to inform them that Windows is shutting down. This can cause the applications to lose data, therefore, you should only use this flag in an emergency.

The "rundll32.exe shell32.dll,SHExitWindowsEx (n)" command mentioned above can be called from the RunOnce registry key.

The runonce.exe -q command mentioned above restarts the computer after a 15 second delay. There are no other options when using this command line, and it cannot be called from the RunOnce registry key.

For additional information about the RunOnce registry key, please see the following article in the Microsoft Knowledge Base:

For a timed choice this below command lets you wait from 1-99 seconds, Where the number 3 is, you can change it to a number from 1-99 seconds.

TYPE NUL | CHOICE.COM /N /CY /TY,3 >NUL

For a console type:

copy con (named file of whatever) >nul

to run the command press F6 and it will run!!!

for errorlevels you can type:

@if "%1"=="(whatever)" (command)

For close window type :

close on exit