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

advertisement
Using ATTRIB, SUBST,
XCOPY, DOSKEY, and the
Text Editor
Ch 7
1
Overview
The purpose and function of
file attributes will be
explained.
Ch 7
2
Overview
Utility commands and programs
will be used to manipulate files
and subdirectories to make tasks
at the command line easier to do.
Ch 7
3
Overview
This chapter will focus on the
following commands and programs:




ATTRIB
XCOPY
DOSKEY
EDIT
Ch 7
4
File Attributes and the
ATTRIB Command
Root directory keeps track of
information about every file
on a disk.
Ch 7
5
File Attributes and the
ATTRIB Command
Each file in the directory
has attributes.
Ch 7
6
File Attributes and the
ATTRIB Command
Attributes represented by single letter:
 S - System attribute
 H - Hidden attribute
 R - Read-only attribute
 A - Archive attribute
Ch 7
7
File Attributes and the
ATTRIB Command
NTFS file system:
 Has other attributes
 At command line only attributes
can change with ATTRIB
command are S, H, R, and A
Ch 7
8
File Attributes and the
ATTRIB Command
ATTRIB command:
Used to manipulate file attributes
Ch 7
9
File Attributes and the
ATTRIB Command
ATTRIB command syntax:
ATTRIB [+R | -R] [+A | -A] [+S | -S]
[+H | -H] [[drive:] [path] filename]
[/S [/D]]
Ch 7
10
File Attributes and the
ATTRIB Command
Attributes most useful to set and unset:
 R - Read-only
 H - Hidden
Ch 7
11
File Attributes and the
ATTRIB Command
The A attribute (archive bit)
signals file has not been
backed up.
Ch 7
12
File Attributes and the
ATTRIB Command
XCOPY command
can read the archive bit.
Ch 7
13
File Attributes and the
ATTRIB Command
 File attributes can be changed
from Windows Explorer.
 Easier to do these tasks from
command prompt.
Ch 7
14
Activity—Using ATTRIB to
make Files Read-Only
KEY CONCEPTS:
 Using + or - alters attribute
 Cannot overwrite or delete readonly files
 Can delete read-only files with /F
parameter with DEL command
Ch 7
15
Using Hidden & Archive
Attributes with ATTRIB
H attribute used to hide file so
when DIR command is used
the file name is not displayed.
Ch 7
16
Using Hidden & Archive
Attributes with ATTRIB
Using hidden attribute allows
for manipulation of files.
Ch 7
17
Using Hidden & Archive
Attributes with ATTRIB
More difficult to perform file
operations on groups of files
simultaneously in Windows
Explorer.
Ch 7
18
Using Hidden & Archive
Attributes with ATTRIB
 The A attribute can flag a file as
changed since the last time it
was backed up.
 ATTRIB command can set and
unset this flag.
Ch 7
19
Activity—Using the
H and the A Attributes
KEY CONCEPTS:
 Reasons for hiding files
 D,R,H,A attributes used to help
manage files
 Use attributes with ATTRIB and
XCOPY
 Space between each parameter - watch
spacing of command syntax carefully
Ch 7
20
Activity—Using the
H and the A Attributes
KEY CONCEPTS:
 Rename file - keeps attributes
 Copy file - does not keep attributes
 Use of + and - in setting and unsetting
file attributes
 Eliminate/add several file attributes
with one command
Ch 7
21
The SUBST Command
SUBST command:
 External command
 Substitutes drive letter for path name
 Alleviates keying in long path name
Ch 7
22
The SUBST Command
SUBST command:
 Installs programs that recognize disk
drive but not the subdirectory
 Derives information from a drive that
a program does not recognize
Ch 7
23
The SUBST Command
Be cautious when using
SUBST with a network drive.
Ch 7
24
The SUBST Command
While substitution is in effect, do not use
SUBST with the following commands:






LABEL
CHKDSK
FORMAT
DISKCOPY
DISKCOM
RECOVER
 FDISK
Ch 7
25
The SUBST Command
SUBST command syntax:
SUBST [drive1: [drive2:]path]
Ch 7
26
The SUBST Command
To undo a substitution:
 SUBST drive1: /D
To see what has been substituted:
 SUBST
Ch 7
27
Activity—Using SUBST
KEY CONCEPTS:
 Virtual/logical drives
 SUBST
 Uses logical/virtual drive letter
Conceptually how networks operate
 Destination - use drive letter and path
SUBST does not recognize drive letter alone
as destination
 When done - undo SUBST
Ch 7
28
The XCOPY Command
Drawbacks of COPY command:
 Reads and copies only one file at a
time
 Cannot copy subdirectory structure
 Copied file does not retain source file
attributes
Ch 7
29
The XCOPY Command
XCOPY command:
 External command
 Copies files that exist in different
subdirectories
 Can specify drive as source to copy all
files on drive.
 Provides overwrite protection
Ch 7
30
The XCOPY Command
XCOPY command:
 Can be specific about characteristics
of files to be backed up
 Faster than COPY
 By default will not copy system or
hidden files
Ch 7
31
The XCOPY Command
Advantages of command line over
using Windows Explorer:
 Drag and drop problems
 Can perform file operations on
group of files rather than one file at
a time
Ch 7
32
The XCOPY Command
XCOPY 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]…]
Ch 7
33
Activity—Using the
XCOPY Command
KEY CONCEPTS:
 Recreating structure on DATA disk
 Uses of /S, /D, and /M with XCOPY
 XCOPY
 Default confirms overwrite
 Can manipulate A attribute
 Can copy hidden files
Ch 7
34
Multiple XCOPY
Parameters
XCOPY command:
 Performs file operations on hidden, system,
and read-only files
 Can manipulate files having one or more
parameters
 Used to accomplish tasks at command line
that cannot be accomplished in GUI
Ch 7
35
Multiple XCOPY
Parameters
Next activity will copy two files
to new directory that had hidden
attributes set without removing
the H attribute.
Ch 7
36
Activity—Using Multiple
XCOPY Parameters
KEY CONCEPTS:
 XCOPY with H and L parameters
 XCOPY with “SHRIEK” parameters
 XCOPY with “SHREK” parameters
 System attributes are hidden
 Changing file attributes
 ATTRIB - order of parameters does
not matter
Ch 7
37
DOSKEY
DOSKEY:
 External, memory-resident command
 Automatically loaded when Command
Prompt window opened
 Enhances command line editing
Ch 7
38
DOSKEY
 DOSKEY remains in memory
only during current DOS session.
 DOSKEY acts like an internal
command.
Ch 7
39
DOSKEY
TSR (Terminal Stay Resident):
 Memory resident commands
 Initially works like external command
 Does not release memory for duration
of Command Prompt work session
Ch 7
40
DOSKEY
DOSKEY:
 Recalls and edits command lines
 Keeps command history
 Used to write a macro
Ch 7
41
DOSKEY
DOSKEY syntax:
DOSKEY [/REINSTALL] [/LISTSIZE=size]
[/MACROS [:ALL | :exename]] [/HISTORY]
[/INSERT | /OVERSTRIKE]
[/EXENAME=exename]
[/MACROFILE=filename] [macroname=[text]]
Ch 7
42
DOSKEY
Editing Keys Command Summary
KEY
Up/down Arrows
ESC
F7
ALT + F7
F8
F9
ALT +F10
EDITING FUNCTION
Recall commands
Clears command line
Displays command history
Clears command history
Searches command history
Selects a command by number
Clears macro definitions
Ch 7
43
DOSKEY
Special codes in Doskey macro definitions:
 $T
 $1-$9
 $*
Command separator
Batch parameters
Symbol replaced by everything
following macro name on
command line
Ch 7
44
Activity—Using DOSKEY
KEY CONCEPTS:
 Using HISTORY parameter with DOSKEY
 Defining batch files and macros
 How to have more than one command on
a line in a Command Prompt Window
 Closing Command Prompt window
eliminates macros created in this window
 Redirecting macros to batch file saves them
Ch 7
45
The Command Prompt
Text Editor
Word-processing program:
 Used for writing needs
 Allows full flexibility in creating and
editing documents
 Most permit saving document as
ASCII text
Ch 7
46
The Command Prompt
Text Editor
Text or ASCII files are used to
give instructions to the
operating system.
Ch 7
47
The Command Prompt
Text Editor
Text editor:
 Used to create text documents
 Used to write batch files
 Not a word processor
 Cannot format data in document
Ch 7
48
The Command Prompt
Text Editor
Text editors:
 Every operating system has one
 NOTEPAD used on desktop
 EDIT used at command prompt
window
Ch 7
49
The Command Prompt
Text Editor
Edit text editor:
 Command line interface text editor
 Not a word processor
 Cannot format data in documents
 Cannot manipulate environment
Ch 7
50
The Command Prompt
Text Editor
Edit text editor menus:
 Screen menu
 Bar at top
 Status bar at bottom
 File menu
 Open new or existing document
 Save or print a document
 Save document under new name
 Exit editor
Ch 7
51
The Command Prompt
Text Editor
Edit text editor menus:
 Edit menu
 Cut, copy, paste, delete selected text
 Search menu
 Find a specified string of text
 Repeat the Last Find
 Search for specified string of text
 Replace string of text with another string of
text
Ch 7
52
The Command Prompt
Text Editor
Edit text editor menus:
 View menu
 Split, Size, or Close Edit window
 Options menu
 Change Printer Port or tab Stops
 Choose Colors for Edit window
Ch 7
53
The Command Prompt
Text Editor
Edit text editor menus:
 Help menu
 Click Commands to get a list of
all available Edit commands
 Click About to view version
information for Edit
Ch 7
54
The Command Prompt
Text Editor
A variety of cursor movement
keys and shortcuts can be
used to edit a text file.
Ch 7
55
The Command Prompt Text
Editor
Table 7.1 Desired Cursor Movement Keys to Use Keyboard
Shortcuts p. 348
Ch 7
56
Activity—Using the
Command Prompt Text
Editor
KEY CONCEPTS:
 Making mouse work
 Insert Vs. overstrike mode
 <Insert> key toggles between two modes
 Full screen editing
 Using mouse and keystrokes
 Selecting text
Ch 7
57
Activity—Using the
Command Prompt Text
Editor
KEY CONCEPTS:
 Viewing two files simultaneously
 Creating macro
 Creating batch files
 To
execute batch file - key in name
Ch 7
58
Using Text Data Files
Use of text editor to create data:
 Desired program not available
 Can import text files from many
programs
 With recorder can record needed
data in text file
Ch 7
59
Activity - Importing a
Text File
KEY CONCEPTS:
 Imported text data into Excel
 Tex Import Wizard screen used to
define data
Ch 7
60
Download