The document provides instructions for common file management tasks in MS-DOS such as using wildcard characters, viewing file contents, copying, moving, renaming, deleting, comparing, and printing files. Key commands discussed include DIR, TYPE, COPY, DEL, REN, FC, and PRINT. Wildcard characters * and ? can be used to select multiple files at once for operations like copying, deleting, or renaming.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
83 views19 pages
Managing Your Files: The MS-DOS File Commands
The document provides instructions for common file management tasks in MS-DOS such as using wildcard characters, viewing file contents, copying, moving, renaming, deleting, comparing, and printing files. Key commands discussed include DIR, TYPE, COPY, DEL, REN, FC, and PRINT. Wildcard characters * and ? can be used to select multiple files at once for operations like copying, deleting, or renaming.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 19
Managing Your Files
The MS-DOS File Commands
Using the Asterisk Wildcard Character: * • can represent up to: – all 8 characters in a file name – all three characters in an extension. • Example: – To specify all files named BUDGET regardless of its extension: C:\>dir budget.* – To specify all file names beginning with B, type the following: C:\>dir b* – To specify all files with the same extension, regardless of name: C:\>dir *.doc Using the Question Mark Wildcard Character: ? • Replaces only one character in a file name or extension – used when one or two characters vary in the middle of a name or extension. • Example: C:\>dir budget.?a?
With commands that can change or delete a file, use wildcard
characters with extreme caution. Using help • Type help to see a list of the commands and press Enter: • Type help followed by the name of the command. Ex: C:\>help date OR C:\>date /? The Directory Command and Its Parameters
• Directory command has either three parameters or more.
– to display only the file name and extension of the directory entries – to arrange directory entries by name, extension, size, or date and time. • Format: dir <filename> /W /P /O<sortorder> /B /S • <filename>: – Precede <filename> with a drive letter. Ex: dir C:report.doc – Use wildcard characters to specify a group of files. Ex: dir budget.* – Omit <filename> to tell MS-DOS to display the entries for all files in the current directory. • /W (wide): – display only the file names and extensions in five columns. – omits file sizes, dates, and times. Cont.. • /P (pause): – display the entries one screenful at a time, press any key to continue. – provides complete file information, including size, date, and time. • /O<sortorder>: – sort (arrange) a directory listing by name, extension, size, or date and time. – dir /on sorts the files alphabetically by file name. – dir /oe sorts the files alphabetically by extension. – dir /os sorts the files by size, smallest to largest. – dir /od sorts the files by date (earliest to latest) and, within the same date, sorts by the time (morning to evening) the file was created or last changed. • /B (Bare): – display only the names and extensions of the files you specify. • /S (Subdirectory): – display the files in the directory you specify and in all subdirectories of the directory. Displaying a File • A quick way to see what's in a text file using the Type command. • Press Pause or Ctrl-Num Lock to freeze the screen for a long and screenful file. • The Type command has one parameter: type <filename> • Can't use wildcard characters in the file name. • Example: C:\>type report.doc Making Copies of Files • The copy command can make a copy of a file: – on the same disk (with a different file name) – on a different disk (with any valid file name) • Format: copy <file1> <file2> – <file1> is the name of the file to be copied (the source file). – <file2> is the name of the copy to be made (the target file). – Wildcard operator can be used to copy a set of files. • FIVE important conditions: i. If you specify a <file1> (including the drive letter) that is not on the disk in the current drive and omit <file2>, MS-DOS copies <file1> to the disk in the current drive and gives the copy the same name as the original. Example (if the current drive is C): copy a:report.mar. Cont… ii. If you specify only a drive letter as <file2>, the file is copied to the disk in the drive you specify and MS-DOS gives it the same name as <file1>. Example: copy report.feb a:. iii. If you specify a <file1> that doesn't exist, MS-DOS responds File not found, followed by the name you typed for <file1> and 0 file(s) copied, and it returns to command level. iv. If <file2> doesn't exist, MS-DOS creates it as a copy of <file1>. v. If you specify a <file2> that does exist and you're using version 6.0 or earlier, MS-DOS replaces its contents with <file1>. This is the same as deleting the existing target file, so be careful not to give the target the same name as an existing file you want to keep. Versions 6.2 and later will warn you with the message Overwrite <file2> (Yes/No/All)? if <file2> already exists in the target location, giving you the opportunity to cancel the copy. Cont… • Examples: a) Copy a file (from & into the current dir) with a different name C:\>copy report.doc results b) Copy a file from a different drive to a current drive A:\>copy c:\dos\readme.txt c) Copy a file (from & into the current dir) with the same file name but different extension C:\>copy budget.mar *.apr d) Copy all files (from & into the current dir) with the same extension but different file name C:\>copy report.* forecast.* e) Copy all files from the current drive to another drive. C:\>copy *.* a: Sending Files to a Device • Use the Copy command to send a copy of the file to the printer. • Can also send a copy of a file to any other output device. • Format: copy <filename> <device> • <filename>: – the name of the file to be sent • <device>: – the name of the device to which the file is to be sent. – Be sure the existing of <device>. Otherwise, MS-DOS might stop running and need to be restarted. • Example: C:\>copy assignment1.doc prn Combining Files • The Copy command allows you to copy several files into a new file without destroying the original versions. • Format: copy <source> <target> • <source>: – represents the files to be combined. – Can use wildcard characters to name the source files to be combined. – Can list several file names, separating each from the next with a plus sign (+). • <target>: – represents the file that results from combining the source files. – If a target is specified, MS-DOS combines the source files into the target file. Cont… • Examples: a) Copy several files into a new file. A:\>copy bank.doc+report.doc bankrpt.doc b) Copy several files into the first file. A:\>copy budget.jan+budget.feb+budget.mar c) Copy all files to a new file. A:\>copy budget.* annuaI.bgt d) Copy pair of files with the same names but different in extension. A:\>copy *.bak+*.doc *.mix Deleting Files • The Delete command (you can type it either as del or as erase) deletes one or more files from a disk. • Format: del <filename> /P • <filename>: – the name of the file to be deleted. – If you use wildcard characters, MS-DOS deletes all files that match <filename>. • /P: – in versions 4 and later, tells MS-DOS to prompt you for verification before deleting the file. • Examples: – A:\>del budget.apr – A:\>del *.bak /p Changing File Names • The Rename (or ren) command changes a file's name or extension, or both. • You can use wildcard characters to rename a set of files. • Format: rename <oldname> <newname> • <oldname>: – the name of an existing file. • <newname>: – the name you want to give to the file specified by <oldname>. • Examples: a) To change the file name: A:\>ren annual.bgt final b) To change the extension: A:\>ren budget.mar *.003 c) To change from txt document to doc document A:\>ren *.doc *.txt Comparing Files • The File Compare (or fc) command compares whether two files are exactly the same. • Format: fc <file1> <file2> • <file1> and <file2> are the file names of the files to be compared. • Examples: – A:\>fc report.txt budget.feb – A:\>fc *.txt *.mix Printing Files • The Print command keeps a list—called the print queue—of files to be printed. • It prints the files in the order in which they appear in the queue. • The print queue normally can hold up to 10 files. • Format: print <filename> /P /C /T • <filename>: – the name of the file to be added to or deleted from the print queue. You can enter more than one file name with a Print command; just type the list of file names, separating each from the next with a blank. • /P (Print): – tells MS-DOS to add <filename> to the print queue. • /C (Cancel): – tells MS-DOS to remove <filename> from the print queue. If the file is being printed, printing stops. • /T (Terminate): – stops all printing. If a file is being printed, printing stops and all files are removed from the print queue. • If you enter the Print command with no parameters, MS-DOS displays the list of files in the print queue. Cont… • The print queue normally holds up to 10 files. • Examples: – Start : i) Single file - A:\>print readme.txt ii) Multiple files - A:\>print readme.txt budget.jan iii) All files with the .txt extension - A:\>print *.txt Name of list device [PRN]: _ <ENTER> – Stop: i) Single file - A:\>print readme.txt /c ii) Multiple or all files - A:\>print /t Cont… • To change the size of the print queue or the name of the printer: print /D:<printer> /Q:<size> • /D:<printer>: – tells MS-DOS to use the printer named <printer>. – If you omit /D:<printer>, MS-DOS uses the standard printer, named PRN. – Ex: /d:lpt2 • /Q:<size>: – tells MS-DOS the number of files the print queue can hold; the minimum number is 4, and the maximum number is 32. – If you omit /Q:<size>, the print queue holds 10 files. – Ex: /q:15