0% found this document useful (0 votes)
59 views5 pages

Batch File Creation2

The document describes examples of batch files that perform various calculations and operations. The batch files clear the screen, change screen colors, prompt users for input values, perform math operations like addition, subtraction, multiplication and division on the input values, store results in variables, display results, pause, and loop back to restart. They demonstrate how to code batch files to prompt for user input, perform basic math, display output, and create simple interactive programs using batch file commands.

Uploaded by

job3220
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
59 views5 pages

Batch File Creation2

The document describes examples of batch files that perform various calculations and operations. The batch files clear the screen, change screen colors, prompt users for input values, perform math operations like addition, subtraction, multiplication and division on the input values, store results in variables, display results, pause, and loop back to restart. They demonstrate how to code batch files to prompt for user input, perform basic math, display output, and create simple interactive programs using batch file commands.

Uploaded by

job3220
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Batch

file Example 1

The batch file should initially clear the screen then the default colors should be
changed as follows:

Background Color:
Aqua

Text Color:
Light Blue


The batch file should then prompt the user with Please enter a value for A: and
then accept a users input.

The batch file should then prompt the user with Please enter a value for B: and
then accept a users input.

The batch file should then add the values for A and B and then store that number
in a variable call sum.

The batch file should then display the sum for A and B.

The batch file should pause

The batch file should loop to the beginning and start again.






















Batch file Example 2



The batch file should initially clear the screen then the default colors should be
changed as follows:

Background Color:
Black

Text Color:
Light Blue


The batch file should then prompt the user with Please enter a value for A: and
then accept a users input.

The batch file should then prompt the user with Please enter a value for B: and
then accept a users input.

The batch file should then multiply the values for A and B and then store that
number in a variable call sum.

The batch file should then display the sum for A and B.

The batch file should pause

The batch file should loop to the beginning and start again.

Batch file Example 3



The batch file should initially clear the screen then the default colors should be
changed as follows:

Background Color:
Aqua

Text Color:
Black


The batch file should then prompt the user with Please enter a value for A: and
then accept a users input.

The batch file should then prompt the user with Please enter a value for B: and
then accept a users input.

The batch file should then subtract the values for A and B and then store that
number in a variable call sum.

The batch file should then display the sum for A and B.

The batch file should pause

The batch file should loop to the beginning and start again.





















Batch file Example 4



The batch file should initially clear the screen then the default colors should be
changed as follows:

Background Color:
Light Purple

Text Color:
Light Yellow


The batch file should then prompt the user with Please enter a value for A: and
then accept a users input.

The batch file should then prompt the user with Please enter a value for B: and
then accept a users input.

The batch file should then divide the values for A and B and then store that
number in a variable call sum.

The batch file should then display the sum for A and B.

The batch file should pause

The batch file should loop to the beginning and start again.






















Batch file Example 5



The batch file should initially clear the screen then the default colors should be
changed as follows:

Background set to red

Foreground set to yellow


The batch file should then display the current date and time displayed with The
Current Date is: and The Current Time is: on a single line

The batch file should then pause

The batch file should then prompt the user with Please enter your name: and
then accept a users input.

The batch file should then create a directory from the name you entered onto the
C drive.

The batch file should list the folders on the C drive.

The batch file should pause and loop to the beginning.

You might also like