0% found this document useful (0 votes)
47 views

Week 10 Tutorial

This document provides instructions and examples for creating batch script programs in Windows. It includes: 1. An example of a simple "Hello World" batch script and explanations of the @echo off and pause commands. 2. Instructions to create a script that takes two numeric inputs from the user and checks if they are equal. 3. Instructions to create a script that takes a single numeric input and checks if it is odd or even. 4. Instructions to create a script that prints the numbers 1 through 10 using a for loop. 5. Instructions to create a basic calculator script using batch that performs addition, subtraction, multiplication, or division based on a user's third input.

Uploaded by

Sanjaya Karki
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views

Week 10 Tutorial

This document provides instructions and examples for creating batch script programs in Windows. It includes: 1. An example of a simple "Hello World" batch script and explanations of the @echo off and pause commands. 2. Instructions to create a script that takes two numeric inputs from the user and checks if they are equal. 3. Instructions to create a script that takes a single numeric input and checks if it is odd or even. 4. Instructions to create a script that prints the numbers 1 through 10 using a for loop. 5. Instructions to create a basic calculator script using batch that performs addition, subtraction, multiplication, or division based on a user's third input.

Uploaded by

Sanjaya Karki
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Fundamentals Of Computing Week 10 Tutorial

Instruction:
Complete all questions in 1 hr.
Let’s get started with nice and easy examples of Batch script:
1. Open your favorite text editor. Save it as filename.bat (All files) right click on the file and
edit> type >
@echo off
echo Hello World!
pause
Run it. You have created your first batch file.
Write the function of set up commands @Echo off and pause.

2. Create a batch program which takes two numeric inputs from the user and checks
whether they are equal or not.

3. Create a batch program which takes a numeric input from the user and checks whether
the input is odd or even.
Fundamentals Of Computing Week 10 Tutorial

Output

4. Create a batch program which prints natural numbers 1 to 10 using for loop.

Output

5. Create a simple calculator using a batch script. Which takes two number and third inputs
can be “add” ,“sub”, “mul”, “div” and displays the result after calculation and displays
error message for any other input in the third. eg: if first input is 2 , second input is 3 and
third input is add then it displays the result 5. Note: use function
6. Write a batch program to swap mouse keys.
7. The following script is the malicious script responsible for system crash. Explain how it
works and explain how you can protect your pc from system crash in Windows OS and
Linux.
It is not permanently harmful for computers but annoying.
Warning: do not run this script.
:S
Start %0
Fundamentals Of Computing Week 10 Tutorial

Goto S

You might also like