pawan ic

Embed Size (px)

Citation preview

  • 8/8/2019 pawan ic

    1/7

    Commands

    A partial list of the most common commands forDOS follows.

    Append

    Display or sets the search path for data files. DOS will search the specified path(s) if the file is not found inthe 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:on|off][/E]

    Attrib

    Change or view 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]]

    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

    o /D - Process folders as well.

    o /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 commandschattr andlsattr.

    cd or chdir

    Change current working directory. Displays the current working directory when used without a

    path parameter.cd

    displays the current working directory on the current drive.

    cd directory

    changes the working directory on the current drive to directory.

    chdir e:directory

    changes the working directory on E: to directory.

    http://en.wikipedia.org/wiki/DOShttp://en.wikipedia.org/wiki/Attribhttp://en.wikipedia.org/wiki/Unixhttp://en.wikipedia.org/wiki/Chattrhttp://en.wikipedia.org/wiki/Lsattrhttp://en.wikipedia.org/wiki/Lsattrhttp://en.wikipedia.org/wiki/Lsattrhttp://en.wikipedia.org/wiki/Chdirhttp://en.wikipedia.org/wiki/Directory_(file_systems)http://en.wikipedia.org/wiki/DOShttp://en.wikipedia.org/wiki/Attribhttp://en.wikipedia.org/wiki/Unixhttp://en.wikipedia.org/wiki/Chattrhttp://en.wikipedia.org/wiki/Lsattrhttp://en.wikipedia.org/wiki/Chdirhttp://en.wikipedia.org/wiki/Directory_(file_systems)
  • 8/8/2019 pawan ic

    2/7

    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 commandcd(with a path parameter), orpwd(without a parameter).

    cd.. changes to the parent directory.

    chkdsk

    Verifies a storage volume (hard disk, partition, floppy disk, flash drive, etc) for file system

    integrity.

    Options:

    /F : Fixes errors on the volume (without /F , chkdsk only detects errors) /P : Forces a full verification

    /R : Searches for defective sectors and recovers legible information (applies /F)

    /X : Unmounts the volume before processing if needed. (Note: Unmounting temporarily

    invalidates all pointers/handlers to the volume until process is completed)

    chkdsk volume letter: [[path]filename] [/F] [/P] [/R] [/X]

    Equivalent to the Unix commandfsck

    cls

    Clears the screen.

    clsEquivalent to the Unixclear.

    copy

    Copies files from one location to another. The destination defaults to the current directory. Ifmultiple source files are indicated, the destination must be a directory, or an error will result.

    Syntax:copy from [source\filename] to [destination\folder]

    Files may be copied to devices. For example, copy file lpt1 sends thefile to the printer on

    LPT1. copy file con outputsfile to the screen ("console"), which can also be done using

    typefile. Devices themselves may be copied: copy con file takes the text typed into the

    console and puts it intofile, stopping when EOF (Ctrl+Z) is typed.

    Files may be concatenated using +. For example, copy file1+file2file_cat will

    concatenate the files and output them asfile_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 of usage:copy /a alpha.txt + beta.txt gamma.txt

    copy /b alpha.mpg + beta.mpg gamma.mp.

    http://en.wikipedia.org/wiki/Unixhttp://en.wikipedia.org/wiki/Chdirhttp://en.wikipedia.org/wiki/Chdirhttp://en.wikipedia.org/wiki/Chdirhttp://en.wikipedia.org/wiki/Pwdhttp://en.wikipedia.org/wiki/Pwdhttp://en.wikipedia.org/wiki/Pwdhttp://en.wikipedia.org/wiki/Chkdskhttp://en.wikipedia.org/wiki/Floppy_diskhttp://en.wikipedia.org/wiki/Fsckhttp://en.wikipedia.org/wiki/Fsckhttp://en.wikipedia.org/wiki/Cls_(computing)http://en.wikipedia.org/wiki/Clear_(Unix)http://en.wikipedia.org/wiki/Clear_(Unix)http://en.wikipedia.org/wiki/Clear_(Unix)http://en.wikipedia.org/wiki/Copy_(command)http://en.wikipedia.org/wiki/LPT1http://en.wikipedia.org/wiki/List_of_DOS_commands#type%23typehttp://en.wikipedia.org/wiki/End-of-filehttp://en.wikipedia.org/wiki/End-of-filehttp://en.wikipedia.org/wiki/Unixhttp://en.wikipedia.org/wiki/Chdirhttp://en.wikipedia.org/wiki/Pwdhttp://en.wikipedia.org/wiki/Chkdskhttp://en.wikipedia.org/wiki/Floppy_diskhttp://en.wikipedia.org/wiki/Fsckhttp://en.wikipedia.org/wiki/Cls_(computing)http://en.wikipedia.org/wiki/Clear_(Unix)http://en.wikipedia.org/wiki/Copy_(command)http://en.wikipedia.org/wiki/LPT1http://en.wikipedia.org/wiki/List_of_DOS_commands#type%23typehttp://en.wikipedia.org/wiki/End-of-filehttp://en.wikipedia.org/wiki/End-of-file
  • 8/8/2019 pawan ic

    3/7

  • 8/8/2019 pawan ic

    4/7

    /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) (this is

    not a parameter, it is output redirection)

    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:DA 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 ofdirinclude:

    /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

    exit

    Exits the current command processor. If the exit is used at the primary command, it has no effectunless in a DOS window under Microsoft Windows, in which case the window is closed and the

    user returns to the desktop.exit [/B]

    /B When used within a batch script, exits the script without closing

    the calling DOS window

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

    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.e.g.: "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.

    find

    http://en.wikipedia.org/wiki/Exit_(command)http://en.wikipedia.org/wiki/Fdiskhttp://en.wikipedia.org/wiki/Find_(command)http://en.wikipedia.org/wiki/Exit_(command)http://en.wikipedia.org/wiki/Fdiskhttp://en.wikipedia.org/wiki/Find_(command)
  • 8/8/2019 pawan ic

    5/7

    A filterto find lines in the input data stream that contain or don't contain a specified string and

    send these to the output data stream.

    Findmay also be used as a pipe.find "keyword" < ''inputfilename'' > ''outputfilename''

    Searches for a text string in a file or files.

    FIND [/V] [/C] [/N] [/I] "string" [[drive:][path]filename[ ...]]

    /V Displays all lines NOT containing the specified string.

    /C Displays only the count of lines containing the string.

    /N Displays line numbers with the displayed lines.

    /I Ignores the case of characters when searching for the

    string.

    "string" Specifies the text string to find.

    [drive:][path]filename Specifies a file or files to search.

    If a pathname is not specified, FIND searches the text typed at the

    prompt

    or piped from another command.

    format

    Delete all the files on the disk and reformat it for MS-DOS

    In most cases, this should only be used on floppy drives or other removable media. This command

    can potentially erase everything on a computer's hard disk.

    /autotest and /backup are undocumented features. Both will format the drive without a

    confirmation prompt.format [options] driveFORMAT drive: [/V[:label]] [/Q] [/F:size] [/B | /S] [/C]

    FORMAT drive: [/V[:label]] [/Q] [/T:tracks /N:sectors] [/B | /S] [/C]

    FORMAT drive: [/V[:label]] [/Q] [/1] [/4] [/B | /S] [/C]

    FORMAT drive: [/Q] [/1] [/4] [/8] [/B | /S] [/C]

    /V[:label] Specifies the volume label./Q Performs a quick format.

    /F:size Specifies the size of the floppy disk to format (such

    as 160, 180, 320, 360, 720, 1.2, 1.44, 2.88).

    /B Allocates space on the formatted disk for system files.

    /S Copies system files to the formatted disk.

    /T:tracks Specifies the number of tracks per disk side.

    /N:sectors Specifies the number of sectors per track.

    /1 Formats a single side of a floppy disk.

    /4 Formats a 5.25-inch 360K floppy disk in a high-density

    drive.

    /8 Formats eight sectors per track.

    /C Tests clusters that are currently marked "bad."

    help

    Gives help about DOS.

    MS-DOShelp 'command' would give help on a specific command. By itself, it lists the contents of

    DOSHELP.HLP. Help for a specific command invokes the command with the /? option

    md or mkdir

    http://en.wikipedia.org/wiki/Filter_(software)http://en.wikipedia.org/wiki/Pipeline_(software)http://en.wikipedia.org/wiki/Undocumented_featurehttp://en.wikipedia.org/wiki/Help_(command)http://en.wikipedia.org/wiki/Mkdirhttp://en.wikipedia.org/wiki/Filter_(software)http://en.wikipedia.org/wiki/Pipeline_(software)http://en.wikipedia.org/wiki/Undocumented_featurehttp://en.wikipedia.org/wiki/Help_(command)http://en.wikipedia.org/wiki/Mkdir
  • 8/8/2019 pawan ic

    6/7

    Makes a new directory. The parent of the directory specified will be created if it does not already

    exist.md directory

    Equivalent to the Unix command mkdir.

    .

    move

    Moves files or renames directories.move filenamenewnamemove driveletter:\olddirdriveletter:\newdir

    Example of usage:move c:\old c:\new

    Equivalent to the Unix commandmv. DR-DOS used a separate command for renaming

    directories, rendir.

    path

    Displays or sets a search path for executable files.

    rd or rmdir

    Remove a directory, which by default must be empty of files for the command to succeed. The

    DELTREE command in DOS removes non-empty directories. In Windows NT's CMD.EXE,rd /s functions in the same way as deltree.

    rem

    Remark statement, normally used within abatch file, or for DOS 6 and above, in CONFIG.SYS.rem This creates a zero-byte file in some command processors.

    rem > newfilename

    :: This never creates a file:: > filename.ext

    Redirecting the output from a rem command produces a zero-byte file in some command

    processors.

    REM is also useful in logged sessions or screen-captures.

    In Unix, the # sign can be used to start a comment.

    ren

    Renames a file. Unlike the move command, this command cannot be used to rename

    subdirectories, or rename files across drives.ren filenamenewname

    You can rename files in another directory by using the PATH parameter:

    ren [[path\]filename] [newfilename]This example renames c:\windows\filex.txt to c:\windows\filey.txt

    ren c:\Windows\filex.txt filey.txt

    Using a path in the destination newname will move the file to the new path, if this is on the same

    device. This renames the file to the c:\temp directory.ren c:\windows\filex.txt \temp\filey.txt

    On DOS with long filename support, care must be taken when directories have spaces in their

    names like "Documents and Settings". In these cases double-quotes are used to enclose them. Note

    it is necessary only to enclose blocks including spaces.

    http://en.wikipedia.org/wiki/Directory_(file_systems)http://en.wikipedia.org/wiki/Move_(command)http://en.wikipedia.org/wiki/Mvhttp://en.wikipedia.org/wiki/Mvhttp://en.wikipedia.org/wiki/Mvhttp://en.wikipedia.org/wiki/Rmdirhttp://en.wikipedia.org/wiki/Batch_filehttp://en.wikipedia.org/wiki/Ren_(command)http://en.wikipedia.org/wiki/Long_filenamehttp://en.wikipedia.org/wiki/Directory_(file_systems)http://en.wikipedia.org/wiki/Move_(command)http://en.wikipedia.org/wiki/Mvhttp://en.wikipedia.org/wiki/Rmdirhttp://en.wikipedia.org/wiki/Batch_filehttp://en.wikipedia.org/wiki/Ren_(command)http://en.wikipedia.org/wiki/Long_filename
  • 8/8/2019 pawan ic

    7/7

    ren c:\"Documents and Settings"\"All Users"\Desktop\filex.txt filey.txt

    ren "c:\Documents and Settings\All Users\Desktop\filex.txt" filey.txt

    Wildcards in the destination are replaced by the corresponding part of the original name, so the

    command below will change the extension of the file from .doc to .txt, here myfile.doc becomes

    myfile.txt.ren myfile.doc 6.txt

    Mass renames can be accomplished by the use of wildcards. For example, the following command

    will change the extension of all files in the current directory which currently have the extension

    htm to html:ren 6.htm 6.html

    In Unix, this functionality of a simple move is provided by themvcommand, while batch renames

    can be done using the rename command.

    scandisk

    Disk diagnostic utility. Scandisk was a replacement for the chkdsk utility, starting with later

    versions of MS-DOS. Its primary advantages overchkdsk is that it is more reliable and has the

    ability to run a surface scan which finds and marks bad clusters on the disk. It also provided

    mouse point-and-clickTUI, allowing for interactive session to complement command-line batch

    run.

    chkdsk had surface scan and bad cluster detection functionality included, and was used again on

    Windows NT based operating systems.

    Equivalent to the Unix commandfsck.

    sys

    A utility to make a volume bootable. Sys rewrites the Volume Boot Code (the first sector of the

    partition that Sys is acting on) so that the code, when executed, will look for Io.sys. Sys also

    copies the core DOS system files, Io.sys, Msdos.sys, and Command.com, to the volume. Sys does

    NOT rewrite the Master Boot Record, contrary to widely-held belief.

    time and date

    Display and set the time and datetime

    date

    When these commands are called from the command line or a batch file, they will display the timeor date and wait for the user to type a new time or date and press RETURN. The commands time

    /t and date /t will display output without waiting for input.

    The Unix commanddatedisplays both the time and date, but does not allow the normal users to

    change either. Users with superuser privileges may use date -s to

    change the time and date.

    The Unix commandtimeperforms a different function.

    tree

    Shows the directory tree of the current directory

    Syntax:tree [options] [directory]

    http://en.wikipedia.org/wiki/Mvhttp://en.wikipedia.org/wiki/Mvhttp://en.wikipedia.org/wiki/Mvhttp://en.wikipedia.org/wiki/Scandiskhttp://en.wikipedia.org/wiki/Text_user_interfacehttp://en.wikipedia.org/wiki/Fsckhttp://en.wikipedia.org/wiki/Fsckhttp://en.wikipedia.org/wiki/Fsckhttp://en.wikipedia.org/wiki/Sys.comhttp://en.wikipedia.org/wiki/Time_and_datehttp://en.wikipedia.org/wiki/Date_(Unix)http://en.wikipedia.org/wiki/Date_(Unix)http://en.wikipedia.org/wiki/Date_(Unix)http://en.wikipedia.org/wiki/Time_(Unix)http://en.wikipedia.org/wiki/Time_(Unix)http://en.wikipedia.org/wiki/Time_(Unix)http://en.wikipedia.org/wiki/Mvhttp://en.wikipedia.org/wiki/Scandiskhttp://en.wikipedia.org/wiki/Text_user_interfacehttp://en.wikipedia.org/wiki/Fsckhttp://en.wikipedia.org/wiki/Sys.comhttp://en.wikipedia.org/wiki/Time_and_datehttp://en.wikipedia.org/wiki/Date_(Unix)http://en.wikipedia.org/wiki/Time_(Unix)