1. Decompressing Files with the Expand Utility
The Expand utility lets
you open the contents of a cabinet (CAB) file or compressed file and
extract the contents. Generally, you use it to extract a missing file
from a CD or other media, most notably Windows files. The advantage of
using this utility is that you can use it with batch or script files to
automate repair actions. An administrator can save time and effort using
this approach for common repairs or repairs that must be made to a
group of machines.
Computing constantly
changes, but some command line utilities don't keep up. Either they work
fine as is, or Microsoft simply decides to let a third party do the
job. At one time, CAB files were the only form of compression widely
available to Windows users. Today, third-party utilities, such as WinZIP
(a share-ware utility you can download and try before you buy), have
largely replaced the need for this particular utility when working with
CAB files. However, you must still use Expand when working with
compressed files—those that have an underscore as part of their file
extension. For example, you'd always use Expand to expand a file named MyApp.EX_ to MyApp.EXE. To make things easier for administrators, WinZIP has a command line add-in (http://www.winzip.com/prodpagecl.htm)
that you can use much like the Expand utility for a much broader range
of compressed file types. Even so, you'll still find that you need the
Expand utility, in some cases, such as when you use the recovery
console, simply because it's the only tool available.
|
You can use the
Expand utility in one of several ways. The information you provide
depends on the way in which you want to use the utility. This utility
uses the following syntax:
EXPAND [-r] Source Destination
EXPAND -r Source [Destination]
EXPAND -D Source.cab [-F:Files]
EXPAND Source.cab -F:Files Destination
Essentially, you
must always provide at least two kinds of information or make an
assumption about the output of the utility. For example, if you supply
the source filename and use the -r
command line switch, Expand makes an assumption about the output
filename based on the source filename. The following list describes each
of the command line arguments.
Source
Name of the
compressed file. The Expand utility works with single compressed files
(those with an underscore in the file extension) and CAB files. It
doesn't work with newer MSI, ZIP, or other compressed files.
Destination
Name of the
uncompressed file when working with a single file. The destination
folder for the uncompressed files when working with a CAB file.
-r
Renames the destination filenames based on the source filename. For example, when you supply MyApp.EX_ as the source filename, Expand automatically uses MyApp.EXE
as the output filename. This option works by using the full name of the
file that's embedded as part of the compressed file.
-D
Displays the list of
files in the source file. When used with a single compressed file, you
see only a single filename as output. CAB files normally contain
multiple files.
-F:
FilesDecompresses
one or more selected files within a CAB file. You can specify multiple
files by supplying wildcard characters. (See the "Working with Wildcard
Characters" sidebar for details.) Don't use multiple copies of the -F
command line switch to specify multiple discrete files. When you want
to expand single files from a CAB file, you must use the Expand utility
once for each file.
The
Expand utility is extremely useful because it doesn't require a running
copy of Windows to work. For example, you can use this utility from the
Recovery Console where other third-party utilities will fail to work.
2. Performing Advanced File Comparison with the FC Utility
The FC utility is a slightly
advanced form of the Comp utility described in an earlier section. You
can use it for the same types of activities, but perform a more flexible
comparison of the two files. For example, this utility has a comparison
mode specifically designed for binary files. This utility uses the
following syntax (the first is for ASCII files; the second is for binary
files):
FC [/A] [/C] [/L] [/LBn] [/N] [/OFF[LINE]] [/T] [/U] [/W] [/nnnn]
[drive1:][path1]filename1 [drive2:][path2]filename2
FC /B [drive1:][path1]filename1 [drive2:][path2]filename2
The following list describes each of the command line arguments.
/A
Displays only the
first and last lines for each set of differences. Normally, the FC
utility (like the Comp utility) displays every line for a set of
differences, making the output difficult to read when the files have a
lot of differences.
/B
Performs a binary
comparison of the two files. This means that the FC utility won't
interpret control characters such as linefeed, carriage return, and end
of file character (ASCII character 26) as it would when performing an
ASCII comparison.
/C
Performs a
case-insensitive comparison of the two files. Normally, FC considers an
upper-case letter different from a lowercase letter.
/L
Performs an
ASCII text comparison of the two files. This setting means that control
characters become important in the comparison, as do the actual
character meanings.
/LB
nDefines the maximum acceptable mismatches between the two files. When FC reaches n, it stops performing the comparison.
/N
Displays the
line numbers for differences. The FC utility compares the two files line
by line, where the carriage return (ASCII character 13), linefeed
(ASCII character 10), or both designate the end of a line.
/OFF[LINE]
Forces the FC utility to compare files even when the files have the offline attribute set.
/T
Forces the FC
utility to retain tabs within the output. Normally, it displays tabs
using the default number of spaces (usually 8) between characters.
/U
Performs a
Unicode comparison of the two files. Unicode character sets include
additional characters to meet the needs of languages other than English.
In addition, Unicode character sets often include characters designed
to express both scientific and mathematical output.
/W
Compresses tabs
and spaces for the purposes of comparison. You'd use this feature when
comparing two data files where the content is important, but the manner
of presentation isn't. Using this technique would let you compare the
actual content of a raw data file against its formatted counterpart.
/nnnn
Specifies
the number of consecutive lines that must match after a mismatch to
continue the comparison. If the source and destination files don't
compare more often than this number allows, then FC discontinues the
comparison.
[drive1:][path1]filename1
Specifies the source file. You can use wildcard characters to define multiple comparisons. For example, *.DLL compares every dynamic link library in the source directory against a DLL with the same name in the destination directory.
[drive2:][path2]filename2
Specifies
the destination file. You can use wildcard characters to define
multiple comparisons. However, the source and destination specifications
must compare. If the source contains just one file, then the
destination will also contain one file as well.