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

4 Lab 4

The lab focuses on teaching students the use of command-line interface (CLI) commands for file manipulation and batch scripting in Windows. Batch files are simple text files that automate tasks, reducing keystrokes and errors while saving time. The document also outlines basic commands, syntax, and an example of batch scripting to illustrate its practical applications.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

4 Lab 4

The lab focuses on teaching students the use of command-line interface (CLI) commands for file manipulation and batch scripting in Windows. Batch files are simple text files that automate tasks, reducing keystrokes and errors while saving time. The document also outlines basic commands, syntax, and an example of batch scripting to illustrate its practical applications.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 13

Applications of Information &

Communication Technologies
(Lab 4)

Ali Hassan
Lab Instructor
Institute of Management Sciences, Peshawar.
CMD NAVIGATION
&
Batch files
Objective of the Lab
• The objective of this lab is to familiarize
students with the use of basic command-
line interface (CLI) commands for file
manipulation, directory navigation, and
simple scripting in Windows
Batch files
• Simple text files containing a series of
commands that get executed in sequence.

• The most common uses are to start


programs and to run utilities.

• Batch files do that with one command


instead of the multiple commands usually
required.
The main advantages to using Batch
Files
• Fewer keystrokes required to perform
computer operations
• Less chance of making typing errors.
• Short commands are easier to remember
than a long series of keystrokes.
• One command executes an extended
chain of complicated operations.
• Major time savings
What is batch scripting
• Simple files which store commands that
can be executed in windows environment
using command prompt in order to do
some meaningful tasks are known as
batch scripts.
Uses
• Automation of various daily routine tasks
• Automation of various deployment tasks
in windows OS.
• Installing various applications on the
system in one go.
• Saving work-hours for the people
• E.t.c
Creating and Execution
• Creation
• Using Notepad ++
• Any other editor like visual studio code

• Execution
• From the same Folder
• Via run command
Commands
• ver - Shows the version of Windows OS
• cd - Change Directory, helps you change the
directory
• md - Make directory, creates a directory
• rd - Remove directory, deletes a directory
• cls - Clears the screen
• dir - Shows you all the contents of a directory
• echo - Shows you the message that follows the
command
• exit - Used to close the console
• rem - Comments a command
• start - Starts the program in a new window
Syntax, Variables & Comments
• Syntaxes
• How do you frame your program?

• Variables
• Playing around setting up and passing the
arguments

• Comments
• Controlling what your program shows and
what not
Example File
• @echo off

• REM set /A variableName=value (avoid spaces with equal)

• set display=Hello World!!



• echo %display%

• set /A first = 20 (/A for numerical values)


• set /A second = 30
• set /A add = %first% + %second%
• echo Sum is = %add%
Important Points
• Complete paths are used for files including
the drive letter.

• Also note the quotes around "C:\Program


Files". Paths must be quoted whenever a
file or folder name has a space in it.

• The redirection symbol ">" that is used to


send the output to a file instead of the
screen (standard output).
Task
• Assignment no 2

You might also like