WHY LEARN COMMAND LINE COMMANDS? - Skagit Valley …
CHAPTER OUTLINEChapter OverviewWill 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 COMMANDThe COPY CommandInternal 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 wrongCopy file from one computer to anotherMake 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 RULESReview of File-naming RulesFile 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 monly 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 FILESMaking Copies of FilesDATA disk in Drive A.Open a Command Prompt window C:\> is displayed.WUGXP directory with files on hard disk.Activity steps.Key in: CD \WUGXPDIR *.TMPCOPY C:\WUGXP\JUP.TMP A:JUP.TMP DIR A: COPY MER.TMPCOPY AST.TMPCOPYVEN.TMPDIR A:COPY AST.TMP A:\ASTROLOGY.FILDIR A:Activity completed.USING LONG FILE NAMESUsing Long File NamesCan 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 slide 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 slide.Discuss alias.Digit assigned by OS.Discuss Sandya~1 etc.Digits assigned on first come basis.ACTIVITY—COPYING FILES WITH LONG FILE NAMESCopying Files with Long File NamesActivity steps.Key in: COPY “SANDY AND NICKI. TXT" A:DIR A: /XActivity completed.USING WILDCARDS WITH THE COPY COMMANDUsing 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 CommandDATA disk in Drive A, C:\WUGX> displayed.Activity steps.Key in: COPY *.TMP A:*.NEWDIR A:*.NEWActivity completed.THE TYPE COMMANDThe TYPE CommandInternal 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] filenameTYPE – command (the work) you want system to perform.[drive:] – represents drive letter (designated disk drive).[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 file name. True of all parts of syntax.To stop scrolling when using TYPE with a long file add:TYPE [drive:] [path] filename | moreMORE 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 COMMANDDisplaying Files Using the TYPE CommandDATA disk in Drive A, and C:\WUGXP> displayed.Activity steps.Key in: TYPE TYPE GAMES\MLINK\MLTORA.EXETYPE GAMES\MATCH32\TUNE1.MIDTYPE JUP.TMPTYPE A:JUP.TMPCD \Activity completed.DUMMY FILESDummy FilesFiles have no particular mon 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 COMMANDSUsing 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.OLDTYPE JUP.TMP JUP.OLDCOPY AST.TMP AST.TMPCOPY AST.TMP ASTROLOGY.TXT TYPE ASTROLOGY.TXT AST.TMPCOPY JUP.TMP JUPITER.TXTCOPY MER.TMP MERCURY.TXTCOPY VEN.TEMP VENUS.TXTDIR *.TMP *.TXTActivity completed.MAKING ADDITIONAL FILES ON THE SAME DISKMaking Additional Files on the Same DiskCan 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 CommandDATA disk in Drive A, A: \> is displayed.Activity steps.Key in: MD \CLASSDIRDIR CLASSCOPY A:\JUP.TMP A:\CLASS\UJUP.PARCOPY MER.TMP CLASS\MER.PARDIR CLASSTYPE JUP.TMP CLASS\JUP.PARTYPE MER.TMPTYPE CLASS\MER.PARActivity completed.USING WILDCARDS WITH THE COPY COMMAND Using Wildcards with the COPY CommandUsed 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 CommandDATA disk in Drive A with A: > displayed.Activity steps.Key in:COPY *.TMP CLASS\*.ABCDIR *.TMP then DIR CLASS\*.ABC TYPE MER.TMPTYPE CLASS\MER.ABCActivity completed.USING COPY AND DIR WITH SUBDIRECTORIES Using COPY and DIR with SubdirectoriesCOPY 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 DIRCOPY \CLASS\JUP.PAR FINAL.RPTCOPY FINAL.RPT NOTE2.TMPCOPY FINAL.RPT NOTE3.TMP DIRMD \WORK MD \WORK\CLIENTSMD \WORK\ADSCOPY *.* \WORK\CLIENTSDIR \WORK\CLIENTSCOPY \WORK\CLIENTS\NOTE?.TMP WORK\ADS\EXAM?.QZDIR \WORK\ADSC:CD \WUGXPCOPY DRESS.UP A:DIR A:DRESS.UPDIR A:\DRESS.UPA:CD C:\ DIR C:ZZZ*.*Activity completed.USING SUBDIRECTORY MARKERS WITH THE COPY COMMAND Using Subdirectory Markers with the COPY CommandCan 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 MarkersDATA disk in Drive A with A: \ASTRONOMY\MERCURY>displayedActivity steps.Key in: COPY FINAL.RPT ..\FIRST.TSTCOPY ..\FIRST.TST ..\VENUS\LAST.TSTDIR ..\VENUSCD \Activity completed.OVERWRITING FILES WITH THE COPY COMMAND Overwriting Files with the COPY CommandUnique 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 CommandDATA disk in Drive A and A: \> is displayed.Activity steps.Key in:TYPE GALAXY.NEW TYPE JUP.OLD COPY GALAXY.NEW JUP.OLDYTYPE GALAXY.NEW TYPE JUP.OLDCOPY JUP.OLD JUP.OLDCOPY *.TMP CLASS\*.PARATYPE JUP.TMP CLASS\JUP.PAR DIR CLASS\*.PARActivity BINING TEXT FILES WITH THE COPY COMMAND Combining Text Files with the COPY CommandConcatenation 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 any of 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 CommandDATA disk in Drive A and A:\> is displayed.Activity steps.Key in: DIR C:\WUGXP\MUSIC/PCancel the commandKey in:TYPE C:\WUGXP\MUSIC\CALIFSURF .TXTTYPE C:\WUGXP\MUSIC\ CALIFSURFHITS .TXT*** (SEE RIGHT COLUMN)COPY C:\WUGXP\MUSIC\CALIFSURF .TXT + C:\WUGXP\MUSIC\ CALIFSURFHITS .TXT CalifSuirf.MUSDIR CALIFSURF.MUSTYPE CALIFSURF.MUSTYPE C:\WUGXP\MUSIC\CALIFSURF.TXTTYPE C:\WUGXP\MUSIC\CALIFSURFHITS.TXTDIR C:\WUGXP\*99COPY C:\WUGXP\*99 NINE.TXTTYPE NINE.TXTTYPE NINE.TXTActivity completed.PRINTING FILES Printing FilesReview: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 ENVIRONMNETPrinting 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 ENVRIONMENTActivity- Setting up printing in a lab environment.Activity Steps.Determine name of network server/printer.Return to desktop by closing command line window.Right-click desktop then Click New/ShortcutFill 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 /YESClick NextIn Shortcut name box key in Print from Command LineClick FinishRepeat step 3Repeat step 4, changing location box information to NET.EXE USE LPT1 /DRepeat step 5Repeat step 6 changing Shortcut name box information to Stop Printing from Command LineClick FinishOpen Command Line window and make A:\> the default promptActivity Completed.ACTIVITY—PRINTING FILES Printing FilesNote 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.TMPPRINT MER.TMPPRINT *.TMPTYPE JUPITER.TXTTurn printer on. Make sure printer is online or command line printing is enabledKey in: TYPE JUPITER.TXT > LPT1COPY JUPITER.TXT LPT1If enabled Print from Command Line, disable it nowClose Command Line Window: Activity completed. ................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.