News Categories |
Main /
Commands of DOS
On this page… (hide) 1. Commands of DOSThis article lists and describes commands of DOS. It focuses on new DOS versions like EDR-DOS, RxDOS and FreeDOS, not on MS-NT-“DOS”. Version differences are mentioned for commands not supported by all 3, not supported by some older versions of them, or differing from MS-DOS or old DR-DOS. There are internal commands, support of them is built-in inside the command file ( COMMAND.COM , FREECOM.COM , RXCMD.EXE or similar), and external “commands”, in fact performed by separate utilities, not working if the required program is not present. 2. Help on internal commandsBoth EDR-DOS and FreeDOS have a built-in help. To list all supported commands, type:
To list help for a single command, specify /? after it:
This works on both, EDR-DOS additionally accepts /H and /h . Finally, the help is included in the file in (almost) plain text, so you can just view it as text and study the full help. Note: Might require un-UPX’ing first. 3. Internal commands list3.1 CD
Changes working directory.
Applying without any parameter displays current setting. 3.2 CDD
Changes drive and working directory at same time. Version differences: exists in FreeDOS only. 3.3 COPYCopies files. A file can be copied to a different volume, a different directory, from or to a “special” device, or even same directory with a new name. Wildcards can be used. Cannot copy directories, use external XCOPY or similar tool instead. Also there is no way to tell COPY to delete the source atfer copying, instead the external utility MOVE is provided for this purpose. Finally the COPY command can also merge files together.
Will copy all files having the extension .ASM from directory F:\FASM to current directory (pointed by the “dot”).
Allows to create the file BLAH.BAT by typing from the keyboard. Press [CTL]-[Z] and [ENTER] when done. For longer texts better use an editor.
Prints HELLO.BAS on a printer connected to LPT1 port. Copying to a printer works only with text files (take care about “CR vs LF vs CR&LF problem”), and “.PRN” files generated (“printed into a file”) extra for the purpose of copying them to the printer later.
Merges 3 pieces into new file MYPROG.EXE . Is “/B” really needed ?
Copies a file into the “special device” NUL in fact discarding the data. Note that there is one L only, thus not “NULL” . This hack was occasionally “recommended” to “test” files, obviously some checknumber (CRC32/MD5/SHA256) calculator would do a much better job. Version differences:
3.4 DATEDisplays current date and asks for a new one. Switch “/T” suppresses asking for the new date, just the current will be displayed. Version differences: Switch “/T” exists in FreeDOS, in EDR-DOS it is supported since 2008-Jun release. 3.5 DELDeletes files, cannot delete subdirectories (use RD instead). Same as ERASE. Wildcards can be used (risky). Applying on a subdirectory will delete all files inside, but not the directory itself. DEL will also not delete files having any of the “R” or “S” or “H” attributes set. External utility DELTREE can delete directories with all content as well as files without the need to remove offending attributes before. Thus there is no way to delete files having “R” or “S” or “H” without external utilities, either ATTRIB or DELTREE is needed. Version differences: FreeDOS will report the amount of files that got deleted when done. 3.6 DIRDisplays volume summary, lists contents of a directory (files and subdirectories) and reports free space. Attributes are not included, external utility ATTRIB is needed to see them. Switch “/A” causes displaying of hidden and systems files also, by default they are skipped. Switch “/P” causes waiting for a keypress after every screen is filled. Switch “/W” suppresses the sizes and dates and displays the file and directory names into 5 columns so that more of them fit on the screen. “/P” still can be used additionally. Switch “/2″ Displays the full info in 2 columns. Switch “/B” provides a minimal variant displaying the file and subdirectory names only in one column, no sizes, no dates, no summary and no free space. Version differences :
3.7 ERAEDR-DOS only, see DEL 3.8 ERASESee DEL 3.9 MDCreates a subdirectory. 3.10 RDDeletes an empty subdirectory. To delete a non-empty one with all contents, external utility DELTREE is needed. 3.11 RENRenames a file or subdirectory. Version differences: Renaming subdirectories is possible in FreeDOS, in EDR-DOS it is supported since 2008-Jun release. 3.12 SETManages environment variables.
Lists all environment variables.
Creates a new variable named “BLAH” (name will be converted into uppercase) with a value of “wow” (remains lowercase).
Deletes the variable “BLAH”.
Will add the string D:\DOS\ to the beginning of the variable PATH, the existing content will survive. PATH is a special “reserved” variable, the effect is that all applications and external “commands” will still be searched in current directory first, but if not found there search continues in pathes specified in this variable (separated by semicolons ( ; ) ), thus D:\DOS\ as next, and even later in other directories specified in this variable from before. Note: those variables are stored in environment space of very limited size (by default 256 bytes (?)), it can be increased using the “/E” switch of the SHELL= command in config file, see Dconfigsys .
3.13 TIMEDisplays current time and asks for a new one. Switch “/T” suppresses asking for the new time, just the current will be displayed. Switch “/C” will display a running clock (not very nice), press a key to stop. Version differences :
3.14 TYPEDisplays a text file to the screen.
has actually the very same effect as :
Switch “/P” :
will cause pausing and waiting for a keypress after every screen if filled - useful with large files. Version differences: Switch “/P” exists in EDR-DOS only. 3.15 VERDisplays version information about the command file. Version differences: In FreeDOS VER alone displays little info only, but there are switches to get more. 4. Names, alternatives to “official” command fileEvery DOS has its own command file, the traditional name since MS-DOS is COMMAND.COM . In FreeDOS the “subproject” is called FreeCOM , but kernel still defaults to the name COMMAND.COM . In every DOS the SHELL= command in config file can be used to specify an alternative name or location of this file. While mixing the kernel from one DOS with command file from another one (other project, or same project but different (older or newer) version) is a bad idea (may run but cause problems, or refuse to work, FreeDOS FreeCOM seems to run with EDR-DOS kernel, vice-versa refuses to run), an independent alternative product not specific to a particular kernel can be used, several such replacements have been written:
See also Dconfigsys . 5. Notable external utilities(also considered as “DOS commands” by some people)
|
Recent Comments