Ch 7 Using ATTRIB, SUBST, XCOPY, DOSKEY and the Text Editor



Chapter 7

Using ATTRIB, SUBST, XCOPY, DOSKEY, and EDIT

ANSWERS TO DISCUSSION QUESTIONS (pp. 361-362)

1. What is the purpose and function of the ATTRIB command?

The ATTRIB command displays file attributes and also allows the user to alter (manipulate) any file attribute for any specific file or files.

2. Give two parameters for the ATTRIB command and describe the function and purpose of each.

Any two of the following would be correct:

+ = Sets attribute

- = Removes attribute

R (Read-only) = Makes a file unable to be altered or deleted.

A (Archive) = Displays and sets the backup history of a file.

S (System file) = Marks a file as a system file. Usually MSDOS.SYS and IO.SYS

H (Hidden file) = Hides filename. Will not display file name in normal DIR mode.

/S = Processes matching files in the current folder and all subfolders.

/D = Processes folders as well.

3. What are file attributes?

File attributes control the way the OS and other applications are able to work with files. There are four file attributes: system file, hidden file, read-only file, and the archive status of a file.

4. What effect does a file marked "hidden" have for a user? How can you “unhide” the file?

The file will not be displayed when using the DIR command. Since the file is not displayed it can be deleted, copied, or renamed. Once hidden, a file can be unhid by using the ATTRIB command with the -H parameter.

5. What does a file marked "read-only" mean to a user?

The user cannot delete, overwrite, or edit a file if it is marked "read-only" unless the user first uses ATTRIB -R .

6. What is the function of the archive bit?

The archive attribute indicates the backup history of a file (whether or not a file has been backed up). If the A attribute is set is set (on) the archive bit knows whether the file has changed since the last time it was copied.

7. What is the purpose of the SUBST command?

The SUBST command allows a directory path to be assigned to a logical drive letter that permits easier access to long paths since they can be accessed with just a drive letter.

8. Under what circumstances would the SUBST command be useful?

The SUBST command is useful for simplifying long path names, installing programs that do not recognize a subdirectory but do recognize a disk drive, and for deriving information from a drive that a program does not recognize.

9. What is the purpose of the XCOPY command?

The XCOPY command can be used to copy files that exist in different subdirectories, as well as to copy the contents of a subdirectory including both files and subdirectories beneath the parent subdirectory. This command allows you to specify a drive as a source and assumes that you wish to copy all the files on the drive. XCOPY will not copy system files or hidden files.

10. What advantages does the XCOPY command have over the COPY command?

COPY

Always available as it is an internal command.

Useful for backing up files from hard disk directories to floppy disks.

Copies one file at a time (even with wild cards) so it is slow.

When copying file the new copy does not have same attributes as source file.

XCOPY

Copies both files and subdirectories.

Copies files specifically by date and only files that have changed since last time XCOPY was used.

Can recreate subdirectory structures and can copy files with attribute bit set.

Provides overwrite protection.

By default will not copy system or hidden files but can be used to perform file operations on them.

Faster than COPY because it reads all source files into memory and then copies them as one group of files.

11. List four XCOPY parameters, and explain their function and their syntax.

XCOPY source [destination] [/A | /M][/D [: date]] [/P] [/S [/E]] [/V] [/W] [/C] [/I] [/Q] [/F] [/L][/H] [/R] [/T] [/U] [/K] [/N] [O] [/X] [/Y] [/-Y] [/Z] [/EXCLUDE:file1 [+file2] [+file3]…]

Listed below are the parameters. However, the ones students have been working with are:

/S = Copy directories/subdirectories except empty ones

/H = Copy hidden and system files

/R = Overwrite read-only files

/I = If destination does not exist & copying more than one file, assumes directory destination

/E - copy empty directories

/K = Keep file attributes – automatically reset read-only attributes

/L = Display files that would be copied

/D = Copy by date

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]… = Species list of files containing strings –If string match any part of absolute path of file to be copied file will excluded from being copied.

/P = Prompts before creating each destination file.

/S = Copies directories and subdirectories except for empty ones.

/P = Prompt before creating each destination file.

/S = Copies directories and subdirectories except empty ones.

/E = Copies directories and subdirectories, including empty ones.

Same as /S /E. May be used to modify /T.

/V = Verifies each new file.

/W = Prompts to press key before copying.

/C = Continues copying even if errors occur.

/I = If destination does not exist & copying more than one file, assumes

destination must be a directory.

/Q = File names not displayed when copying.

/F = Displays full source and destination file names while copying.

/L = Displays files that would be copied.

/H = Copies hidden/system files also.

/R = Overwrites read-only files.

(continued next page)

/T =Creates directory structure, but does not copy files. Does not include

empty directories or subdirectories. /T and /E includes empty directories

and subdirectories.

/U = Copies only files that already exist in destination. Updates the files that

already exist in destination.

/K = Copies attributes. Normal XCOPY will reset read-only attributes.

/N = Copies using generated short names.

/O = Copies file ownership and ACL information.

/X = Copies file audit settings (implies /o).

/Y = Overwrites existing files without prompting.

/-Y = Prompts you before overwriting existing files. (This is the default)

/Z = Copies networked files in restartable mode.

The switch /Y may be preset in the COPYCMD environment variable.

This may be overridden with /-Y on the command line.

12. Explain the purpose and function of the DOSKEY command.

DOSKEY is a TSR command that once loaded into memory, remains in memory during the current MS-DOS session and is used to correct keystrokes, recall command lines, edit them, keep a command history, and write macros (simplify long commands into simple keystrokes or commands). The DOSKEY command is used to reduce the amount of typing you need to do. Its most common use is in recalling which commands you have already used, and allowing you to reenter the same command simply by hitting a key or two.

13. What is a memory-resident program, and how does it work?

A memory-resident program must be loaded into memory from disk. Once loaded, it remains in memory for the duration of the session, which means that you do not need to reload it from disk each time you wish to use it. Once in RAM a memory resident program will not release the memory it is using. It is an “external” command that acts like an internal command. Memory-resident commands are also known as TSRs, (Terminate and Stay Resident). A memory-resident program can be executed by keying in the command name.

14. Explain what a macro is and how you would create one.

A macro is a short key code command which stands for a sequence of saved instructions (commands or keystrokes) that when retrieved will execute the commands to accomplish a given task. Simply put it is saving a set of complicated commands or keystrokes (that are often used) in a file that can be retrieved and executed with a single command. Note that while & is used to separate commands on a command line, it is necessary to separate commands with $T when creating a macro.

15. Discuss how to execute commands from the history list.

To execute commands from the history list save the history list in a batch file and then edit the batch file.

Following are DOSKEY editing keys that can be used to edit command history.

and = Move one at a time up and down the list of commands

= Cancels current command

= Displays command history

+ = Clears command history

= Searches command history

= Selects a command by number

= Clears macro definitions

= Displays oldest command

= Displays newest command

16. How could you use the EDIT program to create useful data information?

At the Command Prompt and key in EDIT. Then, you could key in what information you need.

17. Compare and contrast a word-processing program, Notepad, and EDIT.

Notepad is used on the desktop and Edit is used in the Command Prompt window. They are both used to create text documents that are useful if you wish to give the operating system instructions. It is a way to “talk” to the computer. However, a text document is stripped of all formatting. It does not have the ability to format data in documents and cannot manipulate the environment with margin-size or page length adjustment. Text can only be edited by using menus, the mouse, and keystrokes.

A word processing program allows you full flexibility in creating and editing documents including such features as inserting graphics or using different fonts.

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download