Recent Changes - Search:

Recently Written

News

edit SideBar

Commands of DOS

On this page… (hide)

  1. 1. Commands of DOS
  2. 2. Help on internal commands
  3. 3. Internal commands list
    1. 3.1 CD
    2. 3.2 CDD
    3. 3.3 COPY
    4. 3.4 DATE
    5. 3.5 DEL
    6. 3.6 DIR
    7. 3.7 ERA
    8. 3.8 ERASE
    9. 3.9 MD
    10. 3.10 RD
    11. 3.11 REN
    12. 3.12 SET
    13. 3.13 TIME
    14. 3.14 TYPE
    15. 3.15 VER
  4. 4. Names, alternatives to “official” command file
  5. 5. Notable external utilities

1.  Commands of DOS

This 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 commands

Both EDR-DOS and FreeDOS have a built-in help. To list all supported commands, type:

  • /? or /H or /h EDR-DOS
  • ? FreeDOS (YES, it’s different, no slash)

To list help for a single command, specify /? after it:

DIR /?

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 list

3.1  CD

CD BLAH

Changes working directory.

CD

Applying without any parameter displays current setting.

3.2  CDD

CDD F:\ARACHNE

Changes drive and working directory at same time.

Version differences: exists in FreeDOS only.

3.3  COPY

Copies 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.

COPY F:\FASM\*.ASM .

Will copy all files having the extension .ASM from directory F:\FASM to current directory (pointed by the “dot”).

COPY CON BLAH.BAT

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.

COPY HELLO.BAS LPT1

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.

COPY /B D3XSTUB.BIN + MYPROG.COF + MYOVER.XXX MYPROG.EXE

Merges 3 pieces into new file MYPROG.EXE . Is “/B” really needed ?

COPY VIDEOS\BLOATED.OGV NUL

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:

  • FreeDOS provides a progress indicator, appearing after 15 seconds of copying, DR-DOS and EDR-DOS don’t.
  • [BUG?] If the copied filename already exists in the destination location, FreeDOS will ask whether to overwrite or not. EDR-DOR will silently overwrite, except if the existing file has the “R” attribute set.
  • [BUG?] There is a problem (?) with some Arachne addons due to syntax differences with the “+” hack.

3.4  DATE

Displays 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  DEL

Deletes 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  DIR

Displays 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 :

  • Switch “/B” is not supported in DR-DOS, in EDR-DOS it is only in the latest 2011 “deja vu” release.
  • Switch “/2″ is supported in EDR-DOS only.
  • Some versions of FreeCOM use long file names if DOSLFN is loaded or use the file “DESCRIPT.ION” if present.
  • Newer versions of EDR-DOS also can use long names, but not a “DESCRIPT.ION” file.
  • EDR-DOS supports files > 4 GiB in size (see FATplus), but the size unit is KiB “KB” then, not Byte.
  • [BUG] The “/A” switch doesn’t work in EDR-DOS despite it’s documented as supported.
  • [BUG] FreeDOS FreeCOM does not report the free space if no files are found.
  • [BUG] In FreeCOM the reported free space can be marginally off (if > 1 GiB and < 2 GiB), additionally some versions are unable to see more than cca 2 GiB of free space.
  • [BUG?] FreeCOM accepts multiple masks.

3.7  ERA

EDR-DOS only, see DEL

3.8  ERASE

See DEL

3.9  MD

Creates a subdirectory.

3.10  RD

Deletes an empty subdirectory. To delete a non-empty one with all contents, external utility DELTREE is needed.

3.11  REN

Renames a file or subdirectory.

Version differences: Renaming subdirectories is possible in FreeDOS, in EDR-DOS it is supported since 2008-Jun release.

3.12  SET

Manages environment variables.

SET

Lists all environment variables.

SET blah=wow

Creates a new variable named “BLAH” (name will be converted into uppercase) with a value of “wow” (remains lowercase).

SET blah=

Deletes the variable “BLAH”.

SET PATH=D:\DOS\;%PATH%

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  TIME

Displays 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 :

  • Switch “/T” exists in FreeDOS, in EDR-DOS it is supported since 2008-Jun release.
  • Switch “/C” exists in DR-DOS and EDR-DOS only.

3.14  TYPE

Displays a text file to the screen.

TYPE MYPROG.BAS

has actually the very same effect as :

COPY MYPROG.BAS CON

Switch “/P” :

TYPE MYBIGPRO.BAS /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  VER

Displays 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 file

Every 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)

  • ATTRIB
  • DEBUG
  • DEFRAG
  • DELTREE
  • EDIT
  • FDISK
  • FORMAT (and UNFORMAT)
  • MEM
  • MOVE (very similar to COPY but indeed COPY is internal and MOVE external)
  • SCANDISK or CHKDSK
  • SYS
  • UNDELETE
  • XCOPY
Edit - History - Print - Recent Changes - Search
Page last modified on September 23, 2013, at 08:29 AM