1. assign
The command redirects requests for disk operations on one drive to a different drive.
assign [x[:]=y[:][...]]
assign /STATUS
Options:
* x The drive letter to reassign.
* y The drive letter that x: will be assigned to.
* /STATUS Displays the current drive assignments.
If typed without parameters then all drive letters are reset to original assignments.
The command is available in MS-DOS 5.00.
2. append
(External)
Display or sets the search path for data files. DOS will search the specified path(s) if the file is not found in the current path. This had some creative uses, such as allowing non-CD based games to be run from the CD, with configuration/save files stored on the HD.
append;
append [d:]path[;][d:]path[...]
append [/X:]n|off][/E]
3.attrib
Change or view the attributes of one or more files. It defaults to displaying the attributes of all files in the current directory.
Options:
* To add an attribute attach a '+' in front of it.
* To remove an attribute attach a '-' in front of it
* Attributes include
o R - Read-only
o A - Archive
o S - System
o H - Hidden
attrib [+|-ahrs] [filespec]
Directory Attrib Functions: It is also possible to use ATTRIB across directories.
[drive:][path][filename]
Specifies a file or files for attrib to process.
*
o /D - Process folders as well.
o /S - Process matching files in the current folder and all subfolders.
Roughly equivalent to the Unix commands chattr and lsattr.
4. call
Calls one batch program from another. A new batch file context is created with the specified arguments and control is passed to the statement after the label specified.
Syntax:
call [filespec][batch file parameters]
* filespec: name and if necessary path of the new batch file
* parameters: switches
5. cd or chdir
Change current directory. Displays the current working directory when used without a path parameter.
cd
displays the current working directory on the current drive.
cd f:
displays the current working directory on F:.
cd directory
changes the working directory on the current drive to directory.
chdir e:directory
changes the working directory on E: to directory.
cd ..
changes the working directory to the parent directory (up one directory level).
cd \
changes the working directory to the root (top level) directory of the current drive.
Equivalent to the Unix command cd (with a path parameter), or pwd (without a parameter). cd .. changes to the parent directory.
6. chcp
Changes the code page used to display character glyphs in a console window.
chcp [codepage]
With a numeric parameter, this command changes the codepage setting to codepage. Without a parameter, the command displays the currently active codepage.
7. chkdsk
Verifies a hard disk or a floppy disk for file system integrity.
Options:
* /F :
* /P : Forces a full disk verification
* /R : Searches for defective sectors and recovers legible information (applies /F)
chkdsk drive [[path]filename] [/F] [/V]
Equivalent to the Unix command fsck
8. choice
Allows for batch files to prompt the user to select one item from a set of single-character choices.
Introduced in MS-DOS 6;[1] DR-DOS 7.03.[2]
9. cls
Clears the screen.
cls
Equivalent to the Unix clear.
10. copy
Copies files from one location to another. The destination defaults to the current directory. If multiple source files are indicated, the destination must be a directory, or an error will result.
copy filespec [destination]
Files may be copied to devices. For example, copy file lpt1 sends the file to the printer on LPT1. copy file con outputs file to the screen ("console"), which can also be done using type file. Devices themselves may be copied: copy con file takes the text typed into the console and puts it into file, stopping when EOF (Ctrl+Z) is typed.
Files may be concatenated using +. For example, copy file1+file2 file_cat will concatenate the files and output them as file_cat. There are two switches to modify the command's behaviour, /a (text mode, the default) and /b (binary mode). In text mode, copy will stop when it reaches the EOF character; in binary mode, the files will be concatenated in their entirety, ignoring EOF characters. Examples:
copy /a alpha.txt + beta.txt gamma.txt
copy /b alpha.mpg + beta.mpg gamma.mpg
Equivalent Unix commands are cp (for copying) and cat (for concatenation). Device files may be copied in Unix as well, e.g. cp file /dev/tty will display a file on the screen (but cat file is more commonly used here).
Equivalent RT-11/RSX-11/OpenVMS command is copy.
11. defrag
(in MS/PC-DOS; diskopt in DR-DOS)
Defragments a disk drive.
Options:
* -A – Analyses the fragmentation of a disk drive
* -F – Force defragmentation even if disk space is low
* -V – Verbose output mode
Example of usage:
defrag driveletter: -a -v
No Unix equivalent.
12. del or erase
Deletes one or more files.
del filename
erase filename
Equivalent to the Unix command rm.
Equivalent in RT-11/RSX-11/OpenVMS operating systems line is delete command which can be contracted to del.
13. deltree
Deletes a directory along with all of the files and subdirectories that it contains. Normally, it will ask for confirmation of such a drastic action.
deltree [/y] directory
The /y parameter, if present, tells the deltree command to carry out without first prompting for confirmation.
The deltree command is not included in recent Microsoft Windows operating systems. Deleting a non-empty directory in those versions of Windows where the command is not included, can be achieved by using the rmdir command as in the following example:
rmdir /s [/q] directory
In Unix, the functionality of deltree is provided by the rm command with the parameter -r (or -rf for the /y switch).
14. dir
Lists the contents of a directory.
The dir command typed by itself, displays the disk's volume label and serial number; one directory or filename per line, including the filename extension, the file size in bytes, and the date and time the file was last modified; and the total number of files listed, their cumulative size, and the free space (in bytes) remaining on the disk. The command is one of the few commands that exist from the first versions of DOS.
dir [drive:][path][filename] [parameters]
Most commonly used parameters of dir include:
* /W : Displays the listing in wide format, with as many as five filenames or directory names on each line.
* /P : Pause at every page
* /S : Also look in subdirectories
* /Axx: Display files with the specified attributes only
* /Oxx: Modifies sort order
* /B : Uses bare format (no heading information or summary)
* > [drive:][path][filename] : To Store Result in a text file;(c:\dir > c:\fileList.txt)
Possible attributes for the A parameter are D (directories), R (read-only files), H (hidden files), A (files/directories with the archive bit on), and S (system files). The prefix - negates an attribute; attributes can be combined (e.g. /A:/A means directories with the archive bit on).
Possible sort orders are N (name), S (size), E (extension), D (date and time), A (last access date), and G (group directories first). The prefix - reverses the order.
Other less commonly used parameters of dir include:
* /D : Display wide format but sorted by column
* /L : Display forced into lowercase
* /N : Display forced into long file name format instead of 8.3
* /Q : Displays the owner of each file
* /X : Display shows 8.3 names next to long file names
The default parameters of dir can be set using the DIRCMD environment variable.
Equivalent to the Unix command ls (the option -l is "long" list format, it works the opposite way from /w.)
Equivalent in RT-11/RSX-11/OpenVMS operating systems line is directory command which can be contracted to dir.
15. echo
Prints its own arguments back out to the DOS equivalent of the standard output stream. Usually, this means directly to the screen, but the output of echo can be redirected like any other command. Often used in batch files to print text out to the user.
echo this is text Outputs 'this is text'
echo. Outputs a blank line
Another important use of the echo command is to toggle echoing of commands on and off in batch files.
echo on turns on echoing of commands
echo off turns off echoing of commands
Traditionally batch files begin with the @echo off statement. This says to the interpreter that echoing of commands should be off during the whole execution of the batch file thus resulting in a "tidier" output. The @ symbol declares that this particular command (echo off) should also be executed without echo. For example the following 2 batch files are equivalent:
Batch1.bat:
@echo off
echo The files in your root directory:
dir /b /a-d c:\
Batch2.bat:
@echo The files in your root directory:
@dir /b /a-d c:\
Echo can be used to write to files directly from the console, by redirecting the output stream:
echo text > filename
Echo can also be used to append to files directly from the console, again by redirecting the output stream:
echo text >> filename
To type more than one line from the console into a file, use copy con (above).
Equivalent to the Unix command echo.
16. exe2bin
Converts an executable (.exe) file into a binary file with the extension .com, which is a memory image of the program.
The size of the resident code and data sections combined in the input .exe file must be less than 64KB. The file must also have no stack segment.
17. exit
Exits the current command processor. If the exit is used at the primary command, it has no effect unless in a DOS window under Microsoft Windows, in which case the window is closed and the user returns to the desktop.
EXIT
Exit also exists in Unix-shells. If an exit command is used in the primary command shell under Unix, however, it will logoff the user, similar to the control-D keystroke.
18. fastopen
Main article: FASTOPEN
19. fc or comp
Compares two files or sets of files and displays the differences between them.
FC [/A] [/C] [/L] [/LBn] [/N] [/T] [/W] [/nnnn] [drive1:][path1]filename1 [drive2:][path2]filename2
FC /B [drive1:][path1]filename1 [drive2:][path2]filename2
/A Displays only first and last lines for each set of differences.
/B Performs a binary comparison.
/C Disregards the case of letters.
/L Compares files as ASCII text.
/LBn Sets the maximum consecutive mismatches to the specified number of lines.
/N Displays the line numbers on an ASCII comparison.
/T Does not expand tabs to spaces.
/W Compresses white space (tabs and spaces) for comparison.
/nnnn Specifies the number of consecutive lines that must match after a mismatch.
[drive1:][path1]filename1 Specifies the first file or set of files to compare.
[drive2:][path2]filename2 Specifies the second file or set of files to compare.[citation needed]
Equivalent to the Unix commands comm, cmp and diff.
20. fdisk
Manipulates hard disk partition tables. The name derives from IBM's habit of calling hard drives fixed disks. When run from the command line, it displays a menu of various partitioning operations:
1. Create DOS partition or Logical DOS Drive
2. Set active partition
3. Delete partition or Logical DOS Drive
4. Display partition information
5. Change current fixed disk drive (only available if the computer has more than one hard drive)
FDISK /MBR installs a standard master boot record on the hard drive.
FDISK /MBR #: where # is other partition on system. Completes above command on indicated partition.
eg: "C:\FDISK /MBR D:" would install boot record on D:\ partition.
Fdisk exists under Unix with the same name, but it is an entirely different program. However they share purposes.
0 comments:
Post a Comment