Popular Posts

Wednesday, 21 September 2011

Cmd commands

A partial list of the most common commands for MS-DOS follows.


    Commands beginning with the @ command are never echoed before running. The main use is to prevent batch echo by placing a command @echo off at the beginning of batch files.


    A colon in front of a word, like :label , designates a label. Unlike remarks (REM), labels are not processed by the command processor, so comments might be added proceeded by a pair of colons, eg ::, or by a colon and space.


    Semicolons at the beginning of the line are usually processed by the command processor, but most other programs ignore these. This might be used to add a small batch file to the beginning of a program's data file, in the way that EXTPROC works.


    In PC DOS, OS/2 thus 4OS2, 4DOS, 4NT etc, a batch file beginning with /* is treated as a REXX script. PC DOS 7.0, 2000 and 7.1 implement this feature.

    In REXX, as in C, comments are surrounded by a matching /* comment */.


    Displays 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, using configuration/save files stored on the hard drive.

append [d:]path[;][d:]path[...]
append [/X:on|off][/E]

    The command redirects requests for disk operations on one drive to a different drive.

assign [x[:]=y[:]...
assign /STATUS


    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.


    Attrib changes or views the attributes of one or more files. It defaults to displaying the attributes of all files in the current directory.

ATTRIB [+R|-R] [+A|-A] [+S|-S] [+H|-H][drive:][path][filename] [/S [/D]]


    To add an attribute attach a '+' in front of it.
    To remove an attribute attach a '-' in front of it
    Attributes include
        R - Read-only
        A - Archive
        S - System
        H - Hidden
        /D - Process folders as well.
        /S - Process matching files in the current folder and all subfolders.

Note: Everything inside a brace [option] is an optional item. Roughly equivalent to the Unix commands chattr and lsattr.