0% found this document useful (0 votes)
12 views2 pages

OS Lab 2

OPERATING SYSTEM

Uploaded by

dk7113318
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)
12 views2 pages

OS Lab 2

OPERATING SYSTEM

Uploaded by

dk7113318
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/ 2

DEPARTMENT OF INFORMATION TECHNOLOGY

FACULTY OF ENGINEERING AND TECHNOLOGY


UNIVERSITY OF SINDH, JAMSHORO
LAB # 2
BSIT (Part-III)
SENG- 529 Operating Systems
Command Prompt Scripting and Batch Filing

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.

Scripting languages: A scripting or script language is a programming language that supports


scripts: programs written for a special run-time environment that automate
the execution of tasks that could alternatively be executed one-by-one by a
human operator. Scripting languages are often interpreted (rather than
compiled)

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
DEPARTMENT OF INFORMATION TECHNOLOGY
FACULTY OF ENGINEERING AND TECHNOLOGY
UNIVERSITY OF SINDH, JAMSHORO
ipconfig /all >> results.txt
ping google.com >> results.txt
tracert google.com >> results.txt

Arithmetic Operators

Operator Description

+ (Addition) Adds values on either side of the operator.

- (Subtraction) Subtracts right-hand operand from left-hand operand.

* Multiplies values on either side of the operator.


(Multiplication)

/ (Division) Divides left-hand operand by right-hand operand.

Divides left-hand operand by right-hand operand and


% (Modulus)
returns remainder.

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.

You might also like