Professional Documents
Culture Documents
OS Lab 2
OS Lab 2
LAB # 2
BSIT (Part-III)
SENG- 529 Operating Systems
Command Prompt Scripting and Batch Filing
Student Name________________________________ Role No___________________________
LAB OBJECTIVE: To understand and work with windows command prompt scripting and
batch files
TERMINOLOGIES:
Batch files: a computer file containing a list of instructions to be carried out in turn.
PRACTICAL EXERCISES
Create a bat file having following code, execute it and check the output
ipconfig /all
ping google.com
tracert google.com
PAUSE
Create a bat file having following code, execute it and check the output
Echo off
ipconfig /all
ping google.com
tracert google.com
PAUSE
Create a bat file having following code, execute it and check the output written in results.txt
file
ECHO OFF
ipconfig /all >> results.txt
ping google.com >> results.txt
tracert google.com >> results.txt
Arithmetic Operators
Operator Description
Arithmetic operation
echo off
set a= 10
set b= 20
set /a c = %a%+%b%
echo addition is (%c%)
If statement Syntax
If Condition
Statements
Try this code
IF NOT DEFINED _example ECHO Value Missing
FOR YOU
Write batch script which:
o Computes product and difference of two number
o Prints the result on screen with appropriate message
o And writes output in text file.