Ch 7 Using ATTRIB, SUBST, XCOPY, DOSKEY, and the Text Editor
Chapter 7
Using ATTRIB, SUBST, XCOPY, DOSKEY, and the Text Editor
LEARNING OBJECTIVES
1. Explain the purpose and function of the ATTRIB command.
2. Explain the purpose and function of the SUBST command.
3. Explain the purpose and function of the XCOPY command.
4. Explain the purpose and function of DOSKEY.
5. Use the text editor to create and edit text files.
STUDENT OUTCOMES
1. Use the ATTRIB command to protect files.
2. Use the SUBST command to simplify long path names.
3. Use XCOPY to copy files and subdirectories.
4. Use the XCOPY parameters to copy hidden files and retain file attributes.
5. Use DOSKEY to be more efficient at the command line.
6. Create text files using the text editor.
CHAPTER SUMMARY
1. File attributes are tracked by the operating system.
2. There are four file attributes: A (archive), H (hidden), S (system), and R (read-only).
3. The ATTRIB command allows you to manipulate file attributes.
4. The SUBST command allows you to substitute an unused drive letter for a long, unwieldy path name.
5. The XCOPY command allows you to copy files and subdirectories.
6. There are many parameters available to the XCOPY command. Among them are parameters that enable you to:
a. copy by date (/D)
b. copy hidden files (/H)
c. copy subdirectories (/S)
d. overwrite read-only files (/R)
e. copy empty directories (/E)
f. keep file attributes (/K)
7. DOSKEY is an external, memory-resident program that loads automatically in Windows XP Professional. It allows you to do command line editing.
8. A memory-resident program is commonly referred to as a TSR program. Once loaded into memory, it remains in memory for the duration of the session.
9. The arrow and function keys in DOSKEY allow you to do command-line editing by recalling and listing the previously keyed in commands.
10. You can create macros in a command line window.
11. On the desktop, you use Notepad to edit text files. In the Command Prompt window, you use the Edit editor.
12. Edit can be used to edit or create ASCII text files.
13. In Edit, you can use menus, the mouse, and keystrokes to edit text.
14. Text files can be imported into application programs.
KEY TERMS
|archive attribute |insert mode |system attribute |
|file attribute |overstrike mode |Terminate Stay Resident (TSR) |
|hidden attribute |read-only attribute |text editor |
LECTURE NOTES
|CHAPTER OUTLINE |
|Chapter Overview |
| |
|The purpose and function of file attributes will be explained. |
|Utility commands and programs will be used to manipulate files and subdirectories to make tasks at the command line easier to do. |
|This chapter will focus on the following commands and programs: ATTRIB, XCOPY, DOSKEY, and EDIT. |
| |
|FILE ATTRIBUTES AND THE ATTRIB COMMAND |
|File Attributes and the ATTRIB Command |
|Root directory. |
|Keeps information about each file on disk. |
|File name, extension, size, date/time file last modified, and pointer to file's starting cluster in FAT. |
|Each file in directory has attributes. |
|Sometimes called flags. |
|“Bit” of info either on or off. |
|Describes status of a file. |
|Can store only 1 or 0. |
|Means yes or no, or on or off. |
|Attributes represented by a single letter. |
|S = System attribute. |
|System file. |
|H = Hidden attribute. |
|Hidden files not displayed with DIR command. |
|Files can't be deleted, copied, or renamed. |
|R = Read-only. |
|Can only read file. |
|Can’t modify or delete file. |
|A = Archived file. |
|Back-up history of file. |
|Archive bit turned on - file not backed up. |
|NTFS file system has other attributes. |
|Attribute indicating a compressed/encrypted file and whether file contexts should be indexed for fast file searching. |
|At command line only attributes can change with ATTRIB command are S, H, R, and A. |
|ATTRIB command allows manipulation of file attributes. |
|Syntax diagram. See PowerPoint slide #9. |
|+ = sets attribute. |
|- = removes attribute. |
|R = Read-only. |
|A = Archive. |
|S = System file. |
|H = Hidden file. |
|/S = Processes matching files in current folder and all subfolders. |
|/D = Processes folders as well. |
|Most useful are R and H attributes. |
|The A (Archive bit) gives backup history of a file. It is a signal that the file has not been backed up. |
|COPY command does not turn off the A attribute. |
|XCOPY can read archive bit. |
|Determines if file has changed since last time it was backed up. |
|Decides if file needs to be backed up. |
|Usually do not manually manipulate S attributes with ATTRIB command. |
|ACTIVITY—USING ATTRIB TO MAKE FILES READ-ONLY |
|Using ATTRIB to Make Files Read-Only |
|Command Prompt window open. |
|DATA disk in Drive A, and A:\> is displayed. |
|Specified files can be copied from /SUGXP subdirectory if necessary. |
|Activity steps. |
|Key in: |
|ATTRIB *.99 then ATTRIB C:\*.* |
|COPY C:\WUGXP\*.FIL |
|ATTRIB *.FIL |
|ATTRIB +R STEVEN.FIL |
|ATTRIB STEVEN.FIL |
|DEL STEVEN.FIL |
|COPY C:\WUGXP\*.XLS |
|DIR *.XLS then ATTRIB +R *. XLS |
|ATTRIB *.XLS |
|Minimize command line window |
|Click Start/My Computer |
|Double-click A drive icon |
|Click Tools (on menu bar)/ Folder/Options/ View Tab |
|Remove check from Hide extensions for known file types. |
|Click OK |
|Double-click NEW-SUV.XLS file |
|Click in Cell A-30 (box right below Toyota) |
|Key in Latest Thing |
|Click File (on menu bar)/ Save/ OK/Cancel/ File/Exit/No |
|Close My Computer window |
|Click minimized Command line button on taskbar |
|Key in |
|CLS |
|COPY STEVEN.FIL BETTE.FIL |
|ATTRIB + R BETTE.FIL |
|DEL BETE.FIL |
|DEL /F BETTE.FIL |
|DIR BETTE.FIL |
|Activity completed. |
|USING THE HIDDEN AND ARCHIVE ATTRIBUTES WITH ATTRIB |
|Using the Hidden and Archive Attributes with ATTRIB |
|Hidden attribute. |
|Hides file. |
|Files not displayed with DIR command. |
|Useful - allows for manipulation of files. |
|Files protected when COPY or MOVE commands used with wildcards. |
|Can’t see or manipulate files. |
|More difficult to perform file operations on groups of files in Explorer. |
|Can hide files. |
|Archive bit. |
|Flags a file as changed since last time file backed up. |
|Allows copying of files that have been changed. |
|Automatically set (on) when file written to or changed. |
|ATTRIB command can set and unset this flag. |
| |
|ACTIVITY—USING THE H AND THE A ATTRIBUTES |
|Using the H and the A Attributes |
|Data disk in Drive A and A:\> displayed. |
|Activity steps. |
|Key in: |
|COPY C:\WUGXP\FI*.* |
|DIR F*.* |
|ATTRIB FI*.* +H |
|DIR F*.* |
|MOVE F*.* TRIP |
|DIR /AH |
|ATTRIB -H FI*.* |
|DIR F*.* |
|TYPE STEVEN.FIL |
|ATTRIB STEVEN.FIL |
|ATTRIB -A -R STEVEN.FIL |
|ATTRIB STEVEN.FIL |
|COPY TRIP\FRANK.FIL STEVEN.FIL |
|Press Y |
|Key in: |
|TYPE STEVEN.FIL |
|ATTRIB STEVEN.FIL |
|ATTRIB +R -A STEVEN.FIL |
|ATTRIB STEVEN.FIL |
|REN STEVEN.FIL BRIAN.FIL |
|ATTRIB BRIAN.FIL |
|COPY BRIAN.FIL STEVEN.FIL |
|ATTRIB STEVEN.FIL |
|ATTRIB BRIAN.FIL |
|Activity completed. |
| |
|THE SUBST COMMAND |
|The SUBST Command |
|External command. |
|Can substitute drive letter for a path name. |
|Alleviates keying in long path name. |
|Can install programs that do not recognize subdirectory but do recognize disk drive. |
|Can derive information from a drive that a program does not recognize. |
|Discuss why students should be cautious when using SUBST on a network drive. |
|On stand-alone system while substitution in effect: |
|Do not use SUBST with LABEL, CHKDSK, FORMAT, DISKCOPY, DISKCOM, and RECOVER FDISK. |
|Above commands expect drive letter to represent actual disk drive. |
|SUBST syntax: |
|To set up new drive: SUBST [drive1: [drive2:]path |
|To undo: SUBST drive SUBST drive1: /D |
|To see SUBST drives: SUBST. |
| |
|ACTIVITY—USING SUBST |
|Using SUBST |
|DATA disk in Drive A and A:\ displayed. |
|Can activity be done in your lab? |
|Use a drive letter that is not being used such as H: or K. |
|Activity steps. |
|Key in: |
|TYPE ASTRONOMY\MERCURY\ DRESS.UP |
|SUBST E: A:\ASTRONOMY\MERCURY |
|TYPE E:DRESS.UP |
|SUBST |
|SUBST E: /D |
|SUBST |
|Activity completed. |
| |
| |
| |
|THE XCOPY COMMAND |
|The XCOPY Command |
|Review COPY command. |
|Internal command. |
|Drawbacks. |
|Copies one file at a time even if wildcards are used. |
|Cannot copy subdirectory structure. |
|Slow command. |
|Copy file – does not retain source file attributes. |
|Useful for backing up files from hard disk directories to floppy disks. |
|Cannot use DISKCOPY if you have disks with different formats. |
|XCOPY command. |
|Powerful and useful. |
|External command. |
|Copy files that exist in different subdirectories. |
|Copies contents of subdirectory (both files and subdirectories beneath parent subdirectory). |
|Can specify drive as source to copy all files on the drive. |
|Allows users to be very specific about characteristics of files to be backed up. |
|Copy files and subdirectories that have any attributes. |
|Can specify that files and subdirectories copied retain attributes. |
|Provides overwrite protection (file with same name). Will ask before overwriting destination file with source file. |
|XCOPY is faster than COPY. |
|Reads all source files into memory and then copies them as one group of files. |
|By default will not copy system or hidden files. |
|Advantages of command line over Explorer. |
|Drag and drop problems. |
|Miss destination. |
|Easier to key in commands. |
|Can perform file operations on group of files rather than one file at a time. |
|XCOPY syntax. See PowerPoint slide #32. |
|Source - Specifies file(s) to copy. |
|Destination - Specifies the location and/or name of new files. |
|/A = Copies files with the archive attribute set, doesn't change the attribute. |
|/M = Copies files with the archive attribute set, turns off the archive attribute. |
|/D:date = Copies files changed on or after the specified date. No date given, copies only files whose source time newer than the destination |
|time. |
|/EXCLUDE: file1 [+file2] [+file3]… = Specifies list of files containing strings. If string matches any part of absolute path of file to be |
|copied, file will be excluded from being copied. |
|/P = Prompts before creating each destination file. |
|/S = Copies directories and subdirectories except for empty ones. |
|Syntax continued on the top of right-hand side column for this section. |
| |
|ACTIVITY—USING THE XCOPY COMMAND |
|Using the XCOPY Command |
|DATA disk in Drive A and A:\ displayed. |
|Activity steps. |
|Key in: |
|DIR C:\WUGXP\MEDIA |
|DIR C:\WUGXP\MEDIA\BOOKS |
|XCOPY C:\WUGXP\MEDIA MEDIA /S then D then DIR MEDIA |
|DIR MEDIA\BOOKS |
|DIR C:\WUGXP\*.TXT |
|XCOPY C:\WUGXP\*.TXT /D:06-01-00 then A then ATTRIB *.BUD |
|XCOPY /M *.BUD CLASS |
|ATTRIB *.BUD |
|COPY FILE2.FP AST.BUD |
|Y then ATTRIB *.BUD |
|XCOPY *.BUD CLASS /M |
|Y THEN ATTRIB *.BUD |
|COPY C:\WUGXP\*.TXT |
|A then DIR *.TXT |
|ATTRIB +H SAN*.TXT |
|DIR *.TXT then MD HIDDEN |
|COPY *.TXT HIDDEN |
|XCOPY *.TXT HIDDEN /H |
|A then CD HIDDEN |
|DEL *.* then Y then DIR |
|DIR /AH |
|Activity completed. |
| |
|MULTIPLE XCOPY PARAMETERS |
|Multiple XCOPY Parameters |
|Ability to perform file operations on hidden, system, and read-only files. |
|Manipulate files having one or more attributes set. |
|Accomplish tasks at command line that cannot be accomplished in the graphical user interface. |
| |
|ACTIVITY—USING MULTIPLE XCOPY PARAMETERS |
|Using Multiple XCOPY Parameters |
|DATA disk in Drive A & A:\HIDDEN> displayed. |
|Activity steps. |
|Key in: |
|MD HOLD |
|XCOPY *.TXT HOLD /H |
|DIR HOLD |
|DIR HOLD /AH |
|XCOPY \FILE*.* /L |
|COPY \FILE*.* |
|ATTRIB *.FP +R |
|ATTRIB +S *.CZG |
|ATTRIB *.SWT +S +H +R |
|DIR |
|ATTRIB |
|CD \ |
|MD HIDDEN2 |
|XCOPY HIDDEN HIDDEN2 /S /H /R /E /K |
|CD HIDDEN2 |
|ATTRIB /S |
|CD \ |
|RD HIDDEN /S |
|Y |
|RD HIDDEN2 /S |
|Y |
|Close Command Prompt window. |
|Activity completed. |
| |
|DOSKEY |
|DOSKEY |
|External memory-resident command. |
|Automatically loaded into memory when open Command Prompt window |
|Remains in memory during current DOS session. |
|Keeps track of last 50 commands entered when in Command Prompt window |
|Stores above in memory called command history. |
|Can recall and edit commands. (Table 2.1 in Chapter 2) |
|Once screen is closed and you return to desktop, DOSKEY no longer in memory. |
|Works as a TSR (Terminate Stay Resident). |
|Read from disk and loaded into memory only when first run. |
|No need to reload it from disk each time used. |
|After initial load - Run from memory like internal command. |
|Does not release memory for duration of MS-DOS work session. |
|Can load other programs - other programs will not use memory TSR has claimed. |
|DOSKEY. |
|Recalls command lines and edits them. |
|Keeps command history. |
|Writes a macro. |
|Command defined to automate set of commands that are often used. |
|Kept in file – retrieved/executed with one command |
|Simplifies retyping of commands. |
|& symbol - separates commands on a command line. |
|Separate commands with $T when creating a macro. |
|Syntax: DOSKEY See PowerPoint slide # |
|Definitions in column on right-hand side. |
|Editing keys. See PowerPoint slides #42-44. |
| + clears macro definition (not on chart). |
|Special codes in DOSKEY macro definitions. See PowerPoint slide #45. |
|$T - Command separator. Allows multiple commands on same line. |
|$1-$9 - Batch parameters. Equivalent to %1-%9 in batch files |
|$* - Replaced by everything following macro name on command line. |
| |
|ACTIVITY—USING DOSKEY |
|Using DOSKEY |
|Activity steps. |
|Close current Command Prompt window. |
|Open new Command Prompt window. |
|Key in: |
|A: |
|DIR *.TXT |
|DIR C:\WUGXP\*.99 |
|VOL |
|DOSKEY /HISTORY |
|DOSKEY /HISTORY > TEST.BAT |
|TYPE TEST.BAT |
|CD CLASS & DIR *.BUD & CD \ |
|DOSKEY bb=CD CLASS$TDIR *.BUD$TCD \ |
|bb |
|DOSKEY /MACROS > b.bat |
|TYPE b.bat |
|Activity completed. |
| |
| |
| |
| |
| |
|THE COMMAND PROMPT TEXT EDITOR |
|The Command Prompt Text Editor |
|Used for writing needs. |
|Allows full flexibility in creating/editing documents. |
|Inserting graphics. |
|Changing fonts. |
|To retain selections. |
|Special codes entered into programs as document is formatted. |
|Can save documents as ASCII text (text/unformatted text- MS-DOS texts). |
|Strips formatting and saves only keyed-in text. |
|Text or ASCII files. |
|Used to give OS instructions. |
|Text editors. |
|Creates text documents. |
|Writes batch files. |
|Not a word processor. |
|Cannot format data in document. |
|Every OS has one. |
|NOTEPAD used on desktop. |
|EDIT used at command prompt window. |
|EDIT. |
|Cannot manipulate environment. |
|Edit File menu. |
|Open new document. |
|Open existing document. |
|Save a document. |
|Save a document under new name. |
|Print a document. |
|Exit the editor. |
|Edit menu. |
|Cut, copy, or delete selected text. |
|Paste previously cut or copied text. |
|Search menu. |
|Find specified string of text. |
|Repeat last find and search. |
|Replace a specified string of text with another string of text. |
|View menu. |
|Split, size, or close Edit window. |
|Options menu. |
|Change printer port or tab settings and choose color scheme for edit window. |
|Help menu. |
|Get list of Edit commands. |
| |
|ACTIVITY—USING THE COMMAND PROMPT TEXT EDITOR |
|Using the DOS Text Editor |
|DATA disk in drive A, A: \> displayed. |
|In this section will be editing, creating, and overwriting files with text editor. File size, bytes, and bytes free numbers shown in directory|
|listing will vary – will most likely not match examples shown in text. |
|To make mouse work in window – need to alter some properties of the window. |
|Activity steps. |
|Alter window properties to make mouse work in window. (Window or in full-screen mode) |
|Key in: EDIT |
|Make screen blank then go to full-screen mode. |
|Key in: |
|This is a test. |
|This is more test data. |
|Press + |
|Key in: THIS IS MORE DATA |
|Press . |
|Key in: My second |
|Press . |
|Click under first t in the phrase test data. |
|Hold down left mouse button and drag to end of the sentence. |
|Press key. |
|Key in: meaningless data |
|Click then . |
|Key in: A:\PERSONAL.FIL |
|Click OK then then |
|In Find What area, key in: Jones |
|Click OK. Press key three times. |
|Press key four times. |
|Align the following two lines. |
|FIRST LINE: Peat Brian 125 Second Vacaville CA Athlete |
|SECOND LINE: Farneth Nichole 237 Arbor Vacaville CA Dancer |
|Click File then Exit then No then Yes |
|Open Command Prompt editor |
|Click File then Open. |
|Key in: A:\STEVEN.FIL |
|Click View then Split Window. |
|Change word Frank in top screen to Steven. |
|Click File then Save then File then Close. |
|Place cursor in top window |
|Click File then Open. |
|Key in: A:\TEST.BAT. Click OK |
|Place cursor in bottom window. |
|Click File then Open. |
|Key in: A:\B.BAT. Click OK. |
|In top window delete first line (A:) and the last two lines (DOSKEY /HISTORY and DISKEY /HISTORY >TEXT.BAT) |
|In bottom window, alter line to read: DOSKEY bb=CD CLASS $TDIR *.BUD$TCD |
|Save and then close both files. |
|Exit the editor. |
|Close Command Prompt window |
|Open a Command Prompt window |
|Make A:\ the default drive. |
|Key in: bb then B |
|Close Command Prompt Window |
|Activity completed. |
| |
|USING TEXT DATA FILES |
|Using Text Data Files |
|Why use text editor to create data. |
|Desired program not available. |
|Can import text files from many programs. |
|Interpreted into needed format. |
|With computer can record needed data in a text file. |
|Text files take up little space |
|--Save to floppy – transportable. matter where . |
| |
| |
|ACTIVITY—IMPORTING A TEXT FILE |
|Activity – Importing a text file. |
|At desktop – no open command line windows. |
|Assumes class files installed at C:\WUGXP. If not substitute appropriate directory for environment. |
|Activity steps |
|Open Microsoft Excel Program |
|Click Data on menu bar |
|Point to Import External Data or Get External Data |
|Click Import data or Import Text file on menu |
|Click arrow by Look in: drop down box and navigate to C:\WUGXP |
|Double click PLANETS.TXT |
|Click Next |
|Clear Tab check box |
|Select Comma check box |
|Click Next then Finish then OK then File then Exit then No |
|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.
Related download
- pi batch file interface osisoft
- sonora graphics
- uploading files from pc presentation server
- ch 11 advanced batch files del mar college
- pi batch file interface nt vax and unix
- ch 7 using attrib subst xcopy doskey and the text editor
- command line reference for oracle windows linux and os x
- multi batch help and overview bentley communities
Related searches
- in the text it states synonym
- ch 7 psychology quizlet
- the text states synonym
- another word for the text states
- synonyms for the text states
- the text says synonyms
- other ways to say the text states
- questioning the text strategy
- questioning the text worksheets
- the outsiders ch 7 summary
- happiness is the meaning and the purpose of life the whole aim and end of human
- xcopy folder and all contents