Top 10 Internal and External DOS Commands

Posted by Bhavesh Joshi On Wednesday, January 23, 2013 0 comments

Top 10 Internal and External MS DOS Commands
Top 10 Internet Commands are as follows:

1. Date: When we type the Date command and press enter, it will display the current date in the format mm-dd-yy, (here mm belongs to months, dd belongs to day and yy belongs to year), and it will ask for new date.

Example:
Current date is Thu 03-16-2001
Enter new date (mm-dd-yy)

Here, it will ask you to change the date, if you want to change it.

2. Time: When we type the Time command and press enter, it will display the current time in the format HH:MM:SS.MS, (here HH belongs to Hour, MM belongs to Minute and SS belongs to Second), and it will ask for new time.

Example:
Current time is 12:10:45.56

Enter new time: Here, it will ask you to change the time, if you want to change it.

3. DIR Command: The main function of DIR command is to display the list of files and directories (folders). It displays the whole information including file name, extension, size, date, time and attributes of the files and directories. For all this you have to simply type the Dir and Press enter. It has some forms:

1) DIR/P: Used for page wise listing of directories and files.
2) DIR/W: Used for seeing the entries the sub directories width wise.
3) DIR/S: Used for seeing the sub directories and files.

4. MD Command: it is used for creating new directory Syntax is:  MD

For Example - if you want to create a directory (folder) named TechKoW then MD TechKoW

If the path is not given then, the directory will be created in the current drive.

5. CD Command: This command is used to switch from one directory (folder) to another. That is, it is used to change the directory. The syntax is C:\> CD  

For Example- If you want to go inside the TechKoW directory C:\> CD TechKoW

C:\ TechKoW> It shows that now you are in TechKoW directory. To exit/come out of this directory, just type CD..

6. RD Command: This command is used to remove the directories or subdirectories. To use it, it is necessary that directory or subdirectory which you are going to remove or delete is empty.

C:\>RD

For Example: If you are in TechKoW directory, and you want to remove English sub-directory from it, it is essential to remove all the subdirectories of English first, then only you can remove English through command - RD English

7. Copy Command: The copy command is one of the most versatile of internal commands. The copy command is used to make duplicate of the original. The copy command syntax is
C>COPY

Ex. To make a duplicate copy of a file called by the name first.txt as second.txt
C:>COPY FIRST. TXT SECOND.TXT

8. Delete Command: The delete command is used for remove or erase the file from disk just like as we dispose of unwanted paper files from file folder. The delete command syntax is
C:\>DEL

Ex. Suppose we remove a file first.txt from the disk so we enter the flowing command on prompt  C:\>DEL FIRST.TXT

9. Rename Command: The rename command (or REN for short) can change a file's name or extension or both. The rename command has two parameters:

REN

oldname is the name of existing file and newname is new name for old file.
Ex. REN FIRST.TXT HELLO.TXT

10. PATH Command: The path command tells DOS where to look for command file if its not in the current directory or Internal Command (transient portion of Command.com). The DOS PATH command allows you to specify several subdirectories that DOS will travel in search of external commands. For Example type the following command on prompt

C:\>PATH=C:\DOS;C:\VVS5::\FOX2

DOS search for command in the current path; then in the DOS directory followed by VVS5 and FOX2 directory.

Top 10 Internet Commands

Top 10 External Commands are as follows:

1. CHKDSK: The CHKDSK command allows you to find out if your disk contains changes of lost clusters. When DOS writes information to disk, an error can occur. Although it is rare, but CHKDSK command can help you in correcting these errors. CHKDSK will examine disk and display following information

The total amount of disk.
Disk volume name.
The no. Files and directories and disk space occupied.
Disk space free for storage.

The chkdsk command has the following syntax:

C:\>CHKDSK [volume[[path] filename]]] [/F] [/V]

volume    Specifies the drive letter, mount point, or volume name filename    FAT/FAT32 only: Specifies the files to check for fragmentation

/F Fixes errors on the disk
/V On FAT/FAT32: Display the full path and name of every file of disk.

2. DISKCOPY: The disk copy, command makes an exact duplicate of the original disk. If the disk (target) to be copied is not formatted (remember, the disk needs to be prepared before use), it will format the disk and copy the contents of the original disk (called as source disk) sector by sector. Disk copy works only with disks of same size and capacity. The diskcopy command has three parameters

C:\>DISKCOPY
/V Verifies that the information is copied correctly.

3. XCOPY: The XCOPY command is one of the most versatile of external command. The xcopy command is used to Copies files and directory trees. The xcopy command syntax is
XCOPY source [destination]

source Specifies the file(s) to copy.
destination Specifies the location and/or name of new files or directory.

/P Prompts you before creating each destination file.
/S Copies directories and subdirectories except empty ones.
/E Copies directories and subdirectories, including empty ones. Same as /S /E may be used to modify /T.
/V Verifies each new file.
/W Prompts you to press a key before copying.
/T Creates directory structure, but does not copy files Does not include empty directories or subdirectories.
/T /E includes empty directories and subdirectories.
/-Y Causes prompting to confirm you want to overwrite an existing destination file.

4. Diskcomp: The diskcomp command compares contents of two disks, sectors by sector. If diskcomp command locates errors. The diskcomp command has two parameters

C> DISKCOMP

Sort: the sort command will be use full when we want to arrange (sort) the content of a file or lines of input and send them to output (display). Output can be redirected to a file or device. If we don't specify any parameters with command, then the lines of input will be sorted in ascending order (means numerically from lowest to highest and alphabetically from A to Z). the syntax of sort command is as follows

SORT /R /+

/R (reverse) sorts the lines of input or file in reverse order.
/+ sorting the lines of input or file from the specified position, rather than starting from the first column. To sort a specified file, we have to redirect the input of the sort command flowed by the file name with the input redirection operator <. C:\>sort hello.txt

5. Find: The find command searches for text specified in one or more files. If we enter the command without parameter it filters all lines containing the specified text and display all the lines that contain specified text in the file or files. The find command and its parameters are as follows:

Find /v /c /n /1 <"text to search">
/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.
Ex. C:\> find "Navkar" first.txt

6. DOSKEY Command: This command is initiated by typing DOSKEY and pressing enter. This command stores all DOS commands typed from the DOS prompt into the memory buffer. Any commands in the buffer are recalled by using Up or Down arrow key to list each command in the order they are stored. DOSKEY uses about 4KB of RAM. C:\> DOSKEY
Doskey installed

DOSKEY command keys:

Up/downArrow    Recall DOS commands
F7                                Displays a history of commands
Alt+F7                        Clears the history of command
F8                                Search the history of command
F9                                Select a command by the number displayed using F7.

7. TREE Command. Tree is a command that displays all directory pathnames on the specified disk. An optional /F parameter is available to let you display file names. Syntax is: TREE [drive:][path] [/F] [/A]

/F Display the names of the files in each folder.
/A Use ASCII instead of extended characters.

8. MOVE Command: The MOVE command is a command used to move a directory and one or more files from one location to another on the same disk. You can also change the name of the moved directory and/or files using the MOVE command. The MOVE command prompts you before overwriting an existing file having the same name.

MOVE [/Y /-Y] [drive:][path]dirname1 dirname2

[drive:][path]filename1     Specifies the location and name of the file or files you want to move.
Destination                               Specifies the new location of the file.
[drive:][path]dirname1      Specifies the directory you want to rename.    
dirname2                                   Specifies the new name of the directory.

/Y     Suppresses prompting to confirm you wants to overwrite an existing destination file. Causes prompting to confirm you want to overwrite an existing destination file.  
/-Y     Causes prompting to confirm you want to overwrite an existing destination file.    

By this command we can move a directory.

For example- MOVE C:\techkow1\file1.txt C:\techkow
This command moves a file named file1.txt from the \techkow1 directory to the techkow directory.

C:\> MOVE \DIR123\NEWDIR123
This command moves the directory named \DIR1 23 to a new directory named \NEWDIR123.

9. FORMAT: The FORMAT DOS Command is used to create a new root directory and file allocation table for the disk. It can also check for bad/damaged sectors on the disk and also delete all the data on the disk.

FORMAT volume [/FS:file-system] [/V:label] [/Q] [/A:size] [/C] [/X]
FORMAT volume [/V:label] [/Q] [/F:size]
FORMAT volume [/V:label] [/C)] [/T:tracks /N:sectors]
FORMAT volume [/V:label] [/Q]
FORMAT volume [/Q]

Volume     Specifies the drive letter (followed by a colon), mount point, or volume name.
/FS:             filesystem Specifies the type of the file system (FAT, FAT32, or NTFS).
/V:               label Specifies the volume label.
/Q                Performs a quick format.
/C NTFS only:  Files created on the new volume will be compressed by default.
/X                 Forces the volume to dismount first if necessary. All opened handles to the volume would no longer be valid.
/A:                size Overrides the default allocation unit size. Default settings are strongly recommended for general use.

NTFS supports 512, 1024, 2048, 4096, 8192, 16K, 32K, 64K,
FAT supports 512, 1024, 2048, 4096, 8192, 16K, 32K, 64K,
(128K, 256K for sector size > 512 bytes).
FAT32 supports 512, 1024, 2048, 4096, 8192, 16K, 32K, 64K, (128K, 256K for sector size > 512 bytes).

/F:size            Specifies the size of the floppy disk to format (1.44)
/T:tracks       Specifies the number of tracks per disk side.
/N:sectors     Specifies the number of sectors per track.

Top 10 External Commands10. FDISK Command: FDISK stands for "fixed disk" an older term for the hard disk. FDISK command is used to partition your hard drive. FDISK will first ask you if you want to use all available space for the new partition. FDISK have 2048 Megabytes as the default partition size even if you have more available space on your hard drive. If this value is OK, FDISK will automatically make your new partition and set it active. If you need to change the default size of your partition, you will have to go back and manually make it active. FDISK can also be used to delete partition. This command can also be used to display the partition information for the system.

Take a look at more interesting Command Prompt (MS DOS) Commands. Just Click here!  

Visit also below posts in order to Learn MS DOS (Command Prompt) tricks-

0 comments:

Post a Comment