Huge Collections of Software Manuals and Knowledgebase

GreatManuals.com
Huge Collections of Software Manuals and Knowledgebase

 
Home Contact Us Request to publish your help manuals Request to remove your help manuals

Introduction
 » Quick Batch File Compiler
 » System Requirements
Tutorials
 » Command Line Parameter
 » Batch Files
 » Batch File Examples
 » Windows XP Commands Reference
Ordering & Registration Information
 » Limitation Before Registration
 » How to Register?
 » How to Purchase?
 » Lost Key?
 » Contacts
 

Batch Files

About Batch Files

Batch files are programs that allow MS-DOS and Windows users to create a file to perform a long tasks fast. Such as opening certain programs ran frequently, deleting or managing files, etc. Simple batch files do not require any special programming skills and usually can be done by knowing the below commands and or just DOS commands. A prime example of a batch file for someone whom may know more about Windows or MacOS would be relating a batch file to a shortcut in Windows or icon on a MacOS. Batch files like a shortcuts are small file which is used to run frequently accessed programs. Another example of a very well known batch file is the autoexec.bat, which is simply a boot file loaded each time the computer is loaded. Within this file contains various lines to load various programs and drivers into memory each time the computer boots.

Creating a Batch File

send bulk sms file recovery services best data recovery
usb restore tools usb drive files recovery software key drive recovery
deleted photo recovery disk recovery software freeware deleted partition recovery

To create a basic batch file first open a MS-DOS command prompt and follow the below instructions:

  • At the MS-DOS prompt type edit test.bat and press enter.
  • If typed properly you should now be in a blue screen within the blue screen type: pause dir c:\windows dir c:\windows\system
  • Once the above three lines have been typed in the blue screen choose file and choose exit, when prompted to save click yes
  • Once you are back at the MS-DOS prompt type test. When enter is pressed, this should execute the test.bat file and begin running the file.
  • Because the first line is pause you will first be prompted to press a key. Once you press a key the batch file will run line
  • by line in this case listing the files in the windows and windows\system directory.
  • If you wish to add more lines to this batch file you would simply type "edit test.bat" to edit the file again.

Batch Commands

@ Does not echo back the text after the at symbol. This is most commonly used as @ECHO OFF to prevent any of the commands in the batch file from being displayed just the information needed.
%1

The percent followed by a numeric value, beginning with one, allows users to add variables within a batch file. The following is a batch file example:
echo Hello %1
When the above one line batch file is created and adding your name after the batch file. For example typing myname (being the name of the bat file) and then your name: myname bob

would output:

Hello bob

Note: This can be extended to %2, %3, and so on.

:LABEL By adding a colon in front of a word such as LABEL you create a category, more commonly known as a label. This allows you to skip to certain sections of a batch file such as the end of the batch file. Also see GOTO.
CALL This is used to run another batch file within a batch file. When the batch file that is called is completed the remainder of the original batch file is completed. Note if the batch file does not exist it will give an error message.
CHOICE Allows for batch files and scripts to wait for the user to choose a s set of choices.
CLS Just like the DOS command would clear your screen.
ECHO Will echo a message in the batch file. Such as "ECHO Hello World" will print Hello World on the screen when executed. Note if you have not typed @ECHO OFF at the beginning of the file this will also print "ECHO Hello World" and "Hello World". If you would just like to create a blank line type ECHO. adding the period creates an empty line.
EXIT Exits out of the DOS window if the batch file is ran from Windows.
GOTO LABEL Used to go to a certain label such as LABEL. An example of GOTO would be to GOTO END.
IF Used to check for a certain condition if the condition exists. If that condition exists it will perform that function...
PAUSE Prompt the user to press any key to continue.
REM Allows you to place comments into the batch file without displaying or executing that line when the batch file is run.
SHIFT Changes the position of replaceable parameters in a batch program.
START Used for Windows 95, Windows 98 and Windows NT 4.0 and above to start a windows application such as START C:\WINDOW\CALC would run the Windows Calculator.
Home | Contact Us | Request to publish your help manuals | Request to remove your help manuals