Microsoft Windows Command Prompt: How To Create and Manage File?
Microsoft Windows Command Prompt: How To Create and Manage File?
COMMAND-LINE
Disk-based systems store and handle related pieces of information in groups
called files. The system recognizes and keeps track of the different files in the
system by their filenames. Therefore, each file in the system is required to have a
filename that is different from that of any other file in the directory.
If two files having the same name were present within the same directory of
the system, the computer becomes confused and fails to operate properly. This
is because it cannot determine which version of the file is supposed to be worked
on.
In an MS-DOS environment, there are a few rules that you must remember when
creating new filenames. As mentioned, the filename consists of two parts, a name
and an extension. The filename is a combination of alphanumeric characters
and is between one and eight characters in length. The extension is an optional
addition to the name that begins with a period, and is followed by maximum of
three characters.
Many software packages will automatically generate filename extensions for files
they create. The software does this so that other parts of the program, which may
work with the same file, will be able to identify where the file came from, or what
form it is in.
In any event, you should remember the following seven items when assigning
and using filenames:
1. COPY: The file copy command copies a specified file from one place,
either disk or directory, to another. For example:
• C:\>COPY A:filename.ext B:filename.ext
• C:\>COPY A:filename.ext B: is used if the file is to have the same name in its
new location. The second filename specifier can be omitted.
3. DEL or ERASE: This command allows the user to remove unwanted files from
the disk when typed in at the DOS prompt. For example:
• C:\>DEL filename.ext
• C:\>ERASE B:filename.ext
A great deal of care should be taken when using this command. If a file is
erased accidentally, it may not be retrievable.
6. FC: This file-compare command compares two files to see if they are the same.
This operation is normally performed after a file copy has been performed to
ensure that the file was duplicated and located correctly. For example:
• C:\>FC A:filename.ext B:
If the filename is changed during the copy operation, the command should be
typed as:
• C:\>FC A:filename.ext B:newname.ext
7. ATTRIB: Changes file attributes such as Read-only (+R or –R), Archive (+A or
–A), System (+S or –S), and Hidden (+H or –H). The + and – signs are to add or
subtract the attribute from the file. For example:
• C:\>ATTRIB +R C:\DOS\memos.doc
This command sets the file MEMOS.DOC as a read-only file. Read-only
attributes protect the file from accidentally being overwritten. Similarly, one of the
main reasons for giving a file a Hidden attribute is to prevent it from accidentally
being erased. The System attribute is reserved by the operating system and marks
the file as a system file.
Keep it up!