Instructor: Prof. Michael P. HarrisChapter 5
ITSC 1405 – Intro to PC Operating SystemsInternal Commands – COPY and TYPE

Chapter 5

Internal Commands — Copy and Type

LECTURE NOTES

CHAPTER OUTLINE / TEACHING SUGGESTIONS
Chapter Overview
  • Will review file-naming rules.
  • Will learn some internal commands that can be used to manage and manipulate files.
  • The value of creating and using dummy files will be explained.
  • Will experience naming, managing, manipulating, viewing, and printing files.
  • Will use COPY and TYPE commands to perform various tasks.
  • Both concatenation and the consequences of overwriting files will be discussed.

WHY LEARN COMMAND LINE COMMANDS?

  • Why Learn Command Line Commands?
  • Quick review of directory management commands.
  • MD - make directory.
  • CD - display current directory and path.
  • RD - remove a directory/subdirectory.
  • Directories.
  • Largest unit of information management.
  • Used to organize program and data files.
  • File level.
  • Place to manage information in smaller quantities (housekeeping tasks).
  • Copying files from one directory or one disk to another.
  • Eliminating files no longer needed.
  • Housekeeping tasks different from creating/changing data within file.
  • Must use application program that created data file to change data in file.
  • Managing files.
  • In Windows use Explorer and My Computer to manage files.
  • Learn command line to understand:
  • File manipulation.
  • Disk and subdirectory structure.
  • Some tasks done easier/faster at command line.
  • Copy and rename file takes 2 steps at GUI.
    Only 1 step at command line.
  • Internal commands that help manage files.
  • DIR - see what files are on disk.
  • COPY - make copies of files.
  • RENAME - change names of files.
  • DEL - eliminate files.
  • TYPE - display contents of files.

THE COPY COMMAND

  • The COPY Command
  • Internal command.
  • Makes identical copy of file (source file) and places file where you want it (destination).
  • Reasons for copying files:
  • Copy from one disk to another.
  • Used as backup in case something goes wrong
  • Copy file from one computer to another
  • Make second copy to existing file on same disk.
  • Copy file to device.
  • If device printer – must be ASCII file.
  • Making changes of existing file with program that created it – if you don’t like changes can go back to original.
  • Cannot have two files with same name in same directory but can have them in different directories.
  • Use OS to perform housekeeping tasks – rather than creating copies in application package - do it at OS level.
  • COPY syntax:
COPY [drive:] [path] filename [drive:] [path] filename
- Conceptually - COPY source destination.
  • [drive:] - where file is located.
  • [path] - subdirectory where file is located.
  • Filename - name of file to be copied.
    - OS prior to Windows 95 no spaces between file name and file extension.
    - In Windows, LFN must be enclosed in quotes.
  • WUGXP subdirectory contains practice data files that you will work with so that you do not have to worry about harming your "real" program or "real" data files.

REVIEW OF FILE-NAMING RULES

  • Review of File-naming Rules
  • File name (file specification) has two parts.
  • File name.
  • File specification.
  • File naming rules – PowerPoint slides.
  • Names of files in a directory must be unique.
  • No file name can be longer than 255 characters, including the file extension.
  • File extensions are optional.
  • File name separated from its extension with a period, called a dot.
  • All alphanumeric characters can be used in file names and file extensions except the following (illegal or forbidden) characters:
  • " / \ : | < > * ?
  • Program files.
  • Usually do not name program files - names are assigned by a programmer.
  • Commonly have file extension of .COM, .EXE, or .BAT.
  • Will be naming data files.
  • Use names that reflect file contents.
  • Extensions usually specify type of file.
  • Some application programs will assign a file extension automatically to their data files.

ACTIVITY—MAKING COPIES OF FILES

  • Making Copies of Files
  • DATA disk in Drive A.
  • Open a Command Prompt window C:\> is displayed.
  • WUGXP directory with files on hard disk.
  • Activity steps.
  • Key in:
  • CD \WUGXP
  • DIR *.TMP
  • COPY C:\WUGXP\JUP.TMP A:JUP.TMP
  • DIR A:
  • COPY MER.TMP
  • COPY AST.TMP
  • COPYVEN.TMP
  • DIR A:
  • COPY AST.TMP A:\ASTROLOGY.FIL
  • DIR A:
  • Activity completed.

USING LONG FILE NAMES

  • Using Long File Names
  • Can be used when using floppy disk.
  • Use only when really necessary.
  • Directory entry table has room for 224 files.
  • Floppy disks use old FAT16 file system.
  • Disks designed to hold files that complied with 8.3 rule.
  • Once directory entry table filled cannot place any other files on disk (even if room).
  • Compare two directory entry tables - Figure 5.1 Two Directory Entry Tables – See PowerPoint.
  • Amt. of space data utilizes same – space in root directory varies.
  • At command line enclose entire file specification in quotes if file name has spaces.
  • To see short and long name in directory listing use /X parameter with DIR.
  • Discuss Figure 5.2 Directory Listing Showing Short and Long File Names – See PowerPoint.
  • Discuss alias.
  • Digit assigned by OS.
  • Discuss Sandya~1 etc.
  • Digits assigned on first come basis.

ACTIVITY—COPYING FILES WITH LONG FILE NAMES

  • Copying Files with Long File Names
  • Activity steps.
  • Key in:
  • COPY “SANDY AND NICKI. TXT" A:
  • DIR A: /X
  • Activity completed.

USING WILDCARDS WITH THE COPY COMMAND

  • Using Wildcards with the COPY Command
  • Wildcards - the * and ?.
  • Known as global file specifications.
  • Use with DIR to display a group of files.
  • Use with COPY to copy files on same disk.
  • Can be used to change destination name.
  • Remember that:
  • ? replaces 1 character.
  • * replaces any number of characters.

ACTIVITY—USING WILDCARDS WITH THE COPY COMMAND

  • Using Wildcards with the COPY Command
  • DATA disk in Drive A, C:\WUGX> displayed.
  • Activity steps.
  • Key in:
  • COPY *.TMP A:*.NEW
  • DIR A:*.NEW
  • Activity completed.

THE TYPE COMMAND

  • The TYPE Command
  • Internal command.
  • Opens and displays file on screen.
  • File scrolls – use Pause to stop scrolling.
  • File must be ASCII file for data to be meaningful.
  • TYPE syntax: TYPE [drive:] [path] filename
  • TYPE – command (the work) you want system to perform.
  • [drive:] – represents (designated)drive letter.
  • [path] – name of subdirectory where file is located.
  • Filename.
  • If file has an extension, include it as part of file name.
  • Note: do not key in “filename” but actual filename. True of all parts of syntax.
  • To stop scrolling when using TYPE with a long file add:
  • TYPE [drive:] [path] filename | more
  • MORE filter explained more fully in later chapter.
  • File must be text file to be readable.
  • TYPE command will not display contents of document file created with a word processing program like WordPerfect or Word.

ACTIVITY—DISPLAYING FILES USING THE TYPE COMMAND

  • Displaying Files Using the TYPE Command
  • DATA disk in Drive A, and C:\WUGXP> displayed.
  • Activity steps.
  • Key in:
  • TYPE
  • TYPE GAMES\MLINK\MLTORA.EXE
  • TYPE GAMES\MATCH32\TUNE1.MID
  • TYPE JUP.TMP
  • TYPE A:JUP.TMP
  • CD \
  • Activity completed.

DUMMY FILES

  • Dummy Files
  • Files have no particular meaning.
  • Common in data processing.
  • Used to test different portions of systems or programs.
  • Student will be creating dummy files to learn the DOS commands that manipulate files.
  • COPY command = make copies.
  • TYPE command = display file contents.

ACTIVITY—USING THE COPY AND TYPE COMMANDS

  • Using the COPY and TYPE Commands
  • DATA disk in Drive A and C: WUGXP> displayed.
  • If necessary, use Configuration Table in Chapter 1.6 for appropriate substitutions.
  • Activity steps.
  • Key in:
  • A:
  • COPY JUP.TMP JUP.OLD
  • TYPE JUP.TMP JUP.OLD
  • COPY AST.TMP AST.TMP
  • COPY AST.TMP ASTROLOGY.TXT
  • TYPE ASTROLOGY.TXT AST.TMP
  • COPY JUP.TMP JUPITER.TXT
  • COPY MER.TMP MERCURY.TXT
  • COPY VEN.TEMP VENUS.TXT
  • DIR *.TMP *.TXT
  • Activity completed.

MAKING ADDITIONAL FILES ON THE SAME DISK

  • Making Additional Files on the Same Disk
  • Can have extra copies of files on same disk, but keep in different subdirectory.
  • This way, similar files can be grouped together.
  • Can have same name if file is in different subdirectory - path name makes the file name unique.

ACTIVITY—USING THE COPY COMMAND

  • Using the COPY Command
  • DATA disk in Drive A, A: \> is displayed.
  • Activity steps.
  • Key in:
  • MD \CLASS
  • DIR
  • DIR CLASS
  • COPY A:\JUP.TMP A:\CLASS\UJUP.PAR
  • COPY MER.TMP CLASS\MER.PAR
  • DIR CLASS
  • TYPE JUP.TMP CLASS\JUP.PAR
  • TYPE MER.TMP
  • TYPE CLASS\MER.PAR
  • Activity completed.

USING WILDCARDS WITH THE COPY COMMAND

  • Using Wildcards with the COPY Command
  • Used to copy files on same drive to different directory.
  • Used to save time and keystrokes.
  • Never violate syntax when using OS commands.

ACTIVITY—USING WILDCARDS WITH THE COPY COMMAND

  • Using Wildcards with the COPY Command
  • DATA disk in Drive A with A: > displayed.
  • Activity steps.
  • Key in:
  • COPY *.TMP CLASS\*.ABC
  • DIR *.TMP then DIR CLASS\*.ABC
  • TYPE MER.TMP
  • TYPE CLASS\MER.ABC
  • Activity completed.

USING COPY AND DIR WITH SUBDIRECTORIES

  • Using COPY and DIR with Subdirectories
  • COPY command can place files in subdirectories.
  • DIR command sees that files were copied.

ACTIVITY—USING COPY WITH SUBDIRECTORIES

  • Using COPY with Subdirectories
  • DATA disk is in Drive A with A: \> displayed.
  • Activity steps.
  • Key in:
  • CD ASTRONOMY\MERCURY
  • DIR
  • COPY \CLASS\JUP.PAR FINAL.RPT
  • COPY FINAL.RPT NOTE2.TMP
  • COPY FINAL.RPT NOTE3.TMP
  • DIR
  • MD \WORK
  • MD \WORK\CLIENTS
  • MD \WORK\ADS
  • COPY *.* \WORK\CLIENTS
  • DIR \WORK\CLIENTS
  • COPY \WORK\CLIENTS\NOTE?.TMP WORK\ADS\EXAM?.QZ
  • DIR \WORK\ADS
  • C:
  • CD \WUGXP
  • COPY DRESS.UP A:
  • DIR A:DRESS.UP
  • DIR A:\DRESS.UP
  • A:
  • CD C:\
  • DIR C:ZZZ*.*
  • Activity completed.

USING SUBDIRECTORY MARKERS WITH THE COPY COMMAND

  • Using Subdirectory Markers with the COPY Command
  • Can use dot (.) and double dot (..) as shorthand way of writing commands.
  • Double dot represents parent of current directory.
  • All directories except root have parent directories.
  • Works with all DOS commands.

ACTIVITY—USING SHORTCUTS: THE SUBDIRECTORY MARKERS

  • Using Shortcuts: The Subdirectory Markers
  • DATA disk in Drive A with A: \ASTRONOMY\MERCURY>displayed
  • Activity steps.
  • Key in:
  • COPY FINAL.RPT ..\FIRST.TST
  • COPY ..\FIRST.TST ..\VENUS\LAST.TST
  • DIR ..\VENUS
  • CD \
  • Activity completed.

OVERWRITING FILES WITH THE COPY COMMAND

  • Overwriting Files with the COPY Command
  • Unique name for each file on same disk in same subdirectory.
  • Can use same name if more than one disk, or more than one subdirectory.
  • Overwrite.
  • Write over/replace what used to be in that file.
  • Old data replaced by new data.
  • Overwriting also occurs on same disk when destination file name already exists. Also applies to subdirectories.
  • Process seems dangerous because data lost in file, but overwrite files on regular basis files backed up.
  • Prior to DOS 6.2, if file name on destination disk were the same as source file, destination file would be overwritten with contents of source file without a warning.
  • Now, W warns if there is an overwrite.

ACTIVITY—OVERWRITING FILES USING THE COPY COMMAND

  • Overwriting files using the COPY Command
  • DATA disk in Drive A and A: \> is displayed.
  • Activity steps.
  • Key in:
  • TYPE GALAXY.NEW
  • TYPE JUP.OLD
  • COPY GALAXY.NEW JUP.OLD
  • Y
  • TYPE GALAXY.NEW
  • TYPE JUP.OLD
  • COPY JUP.OLD JUP.OLD
  • COPY *.TMP CLASS\*.PAR
  • A
  • TYPE JUP.TMP CLASS\JUP.PAR
  • DIR CLASS\*.PAR
  • Activity completed.

COMBINING TEXT FILES WITH THE COPY COMMAND

  • Combining Text Files with the COPY Command
  • Concatenation is combining contents of two or more text (ASCII) files.
  • Nothing happens to original files.
  • Create another new file from original files.
  • Most concatenation is accidental and user is unaware it has happened.
  • Occurs easily.
  • Clue is to read messages DOS places on the screen.
  • Concatenation should not be done with either program files or data files that programs generate.
  • Programs are binary code and combining these files makes binary code useless.
  • True of data files that program generates.
  • When data file created - program that created data file "formats" data in way that program knows how to interpret that data.
  • Data file can be read only by program that created it.
  • If program can read foreign data file, it has converted that foreign data into its own data format.

ACTIVITY—COMBINING FILES USING COPY COMMAND

  • Combining Files using COPY Command
  • DATA disk in Drive A and A:\> is displayed.
  • Activity steps.
  • Key in: DIR C:\WUGXP\MUSIC/P
  • Cancel the command
  • Key in:
  • TYPE C:\WUGXP\MUSIC\CALIFSURF .TXT
  • TYPE C:\WUGXP\MUSIC\ CALIFSURFHITS .TXT
  • *** (SEE RIGHT COLUMN)
    COPY C:\WUGXP\MUSIC\CALIFSURF .TXT + C:\WUGXP\MUSIC\ CALIFSURFHITS .TXT CalifSuirf.MUS
  • DIR CALIFSURF.MUS
  • TYPE CALIFSURF.MUS
  • TYPE C:\WUGXP\MUSIC\CALIFSURF.TXT
  • TYPE C:\WUGXP\MUSIC\CALIFSURFHITS.TXT
  • DIR C:\WUGXP\*99
  • COPY C:\WUGXP\*99 NINE.TXT
  • TYPE NINE.TXT
  • TYPE NINE.TXT
  • Activity completed.

PRINTING FILES

  • Printing Files
  • Review:
  • Have not printed contents of any file.
  • May have done:
  • Redirected output of DIR command to printer.
  • Printed file names not file contents.
  • Redirected output of TYPE command to printer (TYPE MY.FIL>PRN).
  • Works only if not on network.
  • Copied file to printer (COPY MY.FIL PRN).
  • No redirection – copying file to a device.
  • Printing to network printer – may not work.
  • Manually eject paper from printer when using redirection and COPY.
  • PRINT command.
  • Prints contents of files – not their names.
  • Automatically ejects pages.
  • Works only for ASCII files.
  • Reasons for printing ASCII files.
  • Hard copy of computer configuration.
  • Printer problem from within an application program.
  • To verify it is a software problem.
  • Return to command line interface and print an ASCII file.
  • If file prints – software problem within application program - not connection problem with printer.
  • Three ways print text file from command line.
  • Use PRINT command.
  • Use redirection with DIR command (Ch02).
  • Copy contents of file to printer.
PRINTING IN A LAB ENVIRONMNET
  • Printing in a lab environment.
  • Printing complicated without a local printer.
  • If only access to printer is a network printer – determine if accommodations have been made for command line printing.
ACTIVITY - SETTING UP PRINTING IN A LAB ENVRIONMENT
  • Activity- Setting up printing in a lab environment.
  • Activity Steps.
  1. Determine name of network server/printer.
  2. Return to desktop by closing command line window.
  3. Right-click desktop then Click New/Shortcut
  4. Fill in location box with information shown below (substituting the name of your server for BUSDDIV and your printer for HP504-1 NET.EXE USE LPT1: \\BUSDIV\HP504-1 /YES
  5. Click Next
  6. In Shortcut name box key in Print from Command Line
  7. Click Finish
  8. Repeat step 3
  9. Repeat step 4, changing location box information to NET.EXE USE LPT1 /D
  10. Repeat step 5
  11. Repeat step 6 changing Shortcut name box information to Stop Printing from Command Line
  12. Click Finish
  13. Open Command Line window and make A:\> the default prompt
  • Activity Completed.

ACTIVITY—PRINTING FILES

  • Printing Files
  • Note 1: DATA disk in Drive A. A:> displayed.
  • Note 2: Do not do this activity if on network unless instructed to do so.
  • Activity steps.
  • Key in:
  • TYPE MER.TMP
  • PRINT MER.TMP
  • PRINT *.TMP
  • TYPE JUPITER.TXT
  • Turn printer on. Make sure printer is online or command line printing is enabled
  • Key in:
  • TYPE JUPITER.TXT > LPT1
  • COPY JUPITER.TXT LPT1
  • If enabled Print from Command Line, disable it now
  • Close Command Line Window:
  • Activity completed.
/  Slides 2-7
 Chapter Overview duplicated in PowerPoint slides.
 After completion of lecture, suggest to students that they review Objectives and Outcomes found on first page of chapter as a check to see if they have mastered concepts.
SECTION 5.1 (pp.185-186)
 Slides 8-13
 Discuss function/purpose of internal commands.
- Once system booted, they stay in memory and are available for use until computer turned off.
- Used to manipulate files.
- - Manipulating files is different than creating or changing data in files.
- Deal with files as objects – not dealing with contents of files.
- Used to manipulate files.
  • Discussion Question (1) - Explain the function and purpose of internal commands.
SECTION 5.2 (pp. 186-187)
 Slides 14-17
 Copying file does not alter original.
 Selectively copy files instead of entire disks.
 For each method of copying files give reasons/examples of why done.
 ASCII file - File contains no “codes” such as bold or italic.
 Copy (command), source (file to be copied), and destination (where copied to) are all mandatory.
 Drive and path do not need to be specified in using default drive and subdirectory.
  • Discussion Question (2) - Give two reasons for making a copy of a file on the same disk.
  • Discussion Question (3) - Give the syntax for the COPY command and explain each part of the syntax.
SECTION 5.3 (pp. 187-188)
 Slides 18-21
 File specifications are file name and file extension.