Week 10 Tutorial
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