Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
55 views16 pages

Activity One: Code: Cls Echo %computername% Dir Pause

Download as docx, pdf, or txt
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 16

Activity One:

Code
cls
echo %computername%
Dir
PAUSE
Screenshot

Activity Two:
Code
@ECHO OFF
CLS
REM Program: script2.bat
REM Author:
REM Date: 28-Mar-2014
REM Purpose: This is my first batch file
REM ----------------------------------------Pause

Echo My First Batch File


Dir
Echo You Just Saw Directory Listing
Echo Hello, %USERNAME%
Echo Bye For Now
Pause
Screenshot

Activity Three:
Code
@ECHO OFF
CLS
REM Program: script2.bat

REM Author:
REM Date: 28-Mar-2014
REM Purpose: This is my first batch file
REM ----------------------------------------Pause
Echo My First Batch File
Dir
Echo You Just Saw Directory Listing
Echo Hello, %USERNAME%
Echo Bye For Now
Pause
Screenshot

Activity Two:
Code
@ECHO OFF
CLS
REM Program: script2.bat
REM Author:
REM Date: 28-Mar-2014
REM Purpose: This is my first batch file
REM ----------------------------------------Pause
Echo My First Batch File
Dir
Echo You Just Saw Directory Listing
Echo Hello, %USERNAME%
Echo Bye For Now
Pause
Screenshot

Activity Three:
Code
@ECHO OFF
REM Program: script3.bat
REM Author:
REM Date: 2015-04-08
REM Purpose: ECHO example
REM ----------------------------TITLE COPS1104-Batch files
CLS
COLOR 57
ECHO.
ECHO This is my fourth batch file
ECHO.
DIR

ECHO I am testing some commands.


ECHO
ECHO I will use these commands in batch file.
ECHO on
Pause
Screenshot

Activity Four:
Code
@ECHO OFF
CLS
SET /P name= Please enter your name:
ECHO Your name is %name%
PAUSE
Screenshot

Activity Five:
Code
CLS
@ECHO OFF
REM Program: script5.bat
REM DATE: 205-04-08
REM Purpose: Finding the total marks
REM -----------------------------------------------------------

SET /P asn_marks= Please enter the assignment mark:


SET /P exam_marks= Please enter the mark for exam:

SET /A final_marks= asn_marks + exam_marks


ECHO Your final mark is %final_marks%
PAUSE
Screenshot

Activity 6:
Code
CLS
@ECHO OFF
SET SRC= c:\batch
SET DST= c:\batch2
CD\

10

MD %DST%
COPY %SRC% %DST%

PAUSE

Code V2
CLS
@ECHO OFF
SET SRC= c:\batch
SET DST= c:\batch2
CD\
MD %DST%
COPY %SRC% %DST%

PAUSE
Screenshot

11

12

13

Activity 6:
Code
CLS
@ECHO OFF

REM Program: script7.bat


REM Purpose: Adding drive C and D to find disk size
REM -------------------------------------------------------

SET driveC=20GB
SET driveD= 180GB
14

SET /A disk_size= driveC+driveD

ECHO %disk_size% GB
PAUSE
Code V2
CLS
@ECHO OFF

REM Program: script7.bat


REM Purpose: Adding drive C and D to find disk size
REM -------------------------------------------------------

SET /P driveC=Please enter the amount of GB in drive C:


SET /P driveD=Please enter the amount of GB in drive D:

SET /A disk_size= driveC+driveD

15

ECHO The total disk size taken up is %disk_size% GB


PAUSE
Screenshot

16

You might also like