Wednesday, June 30, 2010

Distance Conversion Program

This Program converts the value entered in Km to inches, centimetres, feet and metres.

The distance between two cities (in km.) is input through the keyboard.
Write a program to convert and print this distance in meters, feet, inches and centimetres.

Distance Conversion:
1Km = 39370 inches
1Km = 3281 Feet
1Km = 100000 Cm
1Km = 1000 metres


float km,m,cm,inch,foot;

printf("Enter the distance between the two cities in Km: ");
scanf("%f", &km);

inch = 39370*km;
foot = 3281*km;

cm= 100000*km;
m = 1000*km;

printf ("\nDistance converted to inches: %f", inch);
printf ("\nDistance converted to feet: %f", foot);

printf ("\nDistance converted to centimeters: %f", cm);
printf ("\nDistance converted to meters: %f", m);


Tuesday, June 29, 2010

C Program for calculation of Gross Salary

This program takes into account the allowances of a particular candidate and then finally counts the Gross Salary.
The value of the Basic Salary is entered through the keyboard.

Lara's basic salary is input through the keyboard.
Her dearness allowance is 35% of basic salary, and house rent allowance is
25% of basic salary. Write a program to calculate her gross salary.

main ()

int basic;
float gross;

printf("Enter your Basic Salary: ");

scanf("%d", &basic);

gross = basic+(0.35*basic)+(0.25*basic);

printf("Your Gross Salary is: %f",gross);


Monday, June 28, 2010

C Program to calculate Area, Perimeter of Rectangle; Area, Circumference of Circle.

The program helps you calculate the area and perimeter of a rectangle.
It also calculates the area and the circumference of the circle.
The values of Length, Breadth and Radius are to be entered through the keyboard.

The length and breadth of a rectangle and radius of a circle are input
through the keyboard. Write a program to calculate the area and perimeter of the rectangle,
and the area and the circumference of the circle.

aor: area of rectangle
por: perimeter of rectangle
aoc: area of circle
coc: circumference of circle


float length, breadth, radius, aor, por, aoc, coc;

printf ("\nEnter the Length and Breadth of the Rectangle: ");
scanf("%f %f", &length, &breadth);

printf("\nEnter the Radius of the Circle: ");
scanf("%f", &radius);

aor = length*breadth;
por= 2*(length+breadth);

aoc = 3.14*radius*radius;

coc = 2*radius*3.14;

printf("\nThe area of the rectangle is: %f", aor);

printf("\nThe perimeter of the rectangle is: %f ", por);

printf("\n\nThe area of the Circle with radius %f is: %f ", radius, aoc);

printf("\nThe circumference of the same circle is: %f", coc);


Sunday, June 27, 2010

Add first seven terms for loop

Write a program to add first seven terms of the following series using a for loop:

(1/1!) + (2/2!) + (3/3!) + .....

float result, temp_calc, num, temp, factorial;


for (num=1; num<=7; num++)

for (temp=1, factorial=1; temp<=num; temp++)


factorial = factorial*temp;

temp_calc = (num/factorial);




printf("(1/1!) + (2/2!) + (3/3!) + (4/4!) + (5/5!) + (6/6!) + (7/7!) = %f", result);


Saturday, June 26, 2010

Print all prime numbers from 1 to 300

Write a program to print all prime numbers from 1 to 300.
(Hint: Use nested loops, break and continue statements.)

The work done by the computer is considerably used..if we chuck out all the even numbers..cuz even numbers cannot be prime numbers (except the number 2)

Also, 1 is not a prime number. is a Unique Number.


int number, div, ifprime;

for (number=2;number<=300;number++)


for (div=2; div
if (number%div==0)




if (ifprime)
printf("\n%d", number);


Friday, June 25, 2010

Fill the screen with a smiling face

Write a program to fill the entire screen with a smiling face.
The smiling face has an ASCII value 1.

Other ideas..
An infinite loop like the following can also do the job.
for (i=1;i<=1000;)

int i, j;

for (i=1, j=1; j<=5000; j++)

printf("%c", i);

Thursday, June 24, 2010

Printing ASCII Table with Numbers and corresponding characters.

The following program prints the ASCII Table with the numbers from 0 to 255 and their corresponding equivalent characters in ASCII.

Write a program to print all the ASCII values and their equivalent
characters using a while loop. The ASCII values vary from 0 to 255.

int num;

printf("Printing ASCII values Table...\n\n");

num = 1;



printf("\nValue:%d = ASCII Character:%c", num, num); /*This change has been made as per the comment. Thank you anonymous Blog Viewer ... */




Mistake made in this program was two variables one with int and one with char type were taken...the other being redundant.
The change has been made here on the blog, but it still remains to be changed in the file to be downloaded. Will do that soon.

Wednesday, June 23, 2010

Calculation of One Number Raised to Another.

Two numbers are entered through the keyboard. Write a program to find the value of one number raised to the power of another.

int num1, index, result, temp; /* num2=index*/

printf("Enter the number:");
scanf ("%d", &num1);

printf("Enter the index:");
scanf("%d", &index);



result = result*num1;



printf("%d raised to %d is: %d ", num1, index, result);


Tuesday, June 22, 2010

Detection of a Prime Number

Write a program to determine whether a number is prime or not.
A prime number is one, which is divisible only by 1 or itself.

int num, i;

printf ("Enter a number:");
scanf ("%d", &num);

while (i<=num - 1)

if (num % i ==0)

printf ("Not a prime number");


if (i == num)

printf ("Prime Number");

Program to Open a file, read a file and write to a file

int main()
float sales , commission;
FILE *fin, *fout;
fin = fopen("c:\\pop.dat","r");
fout = fopen("c:\\pop2.dat","w");
while (fscanf(fin,"%f",&sales) != EOF)
fprintf(fout,"Your sales for the year were %8.2f \n",sales);
if(sales < 30000)
commission = sales / 100 * 5;
commission = sales / 100 * 10;Program to Open a file, read a file and write to a file

fprintf(fout,"Your commission is %8.2f",commission);
return 0;

Monday, June 21, 2010

WAP to find out Even or Odd number (IF-ELSE)

void main ()


int a;

clrscr ();

printf ("Enter the value of A: ");


if (a%2==0)


printf ("\nNumber is Even");




printf("\nNumber is Odd");


getch ();


Sunday, June 20, 2010

20 MS DOS command you probably dont know

20 MS DOS command you probably dont know

ATTRIB , The command is short for ATTRIB -a -h -r - s *.* (removes all attributes of a file).
BACKUP /HP Unknown
DIR , This lists all files including hidden files, does not work in Windows 95 / 98 / NT / 2000.
DIR ... Lists all directories that do not have extensions. In Windows 95 / Windows 98 will list the contents of the directories previous to the directory currently in.
DOSKEY /APPEDIT Utilize doskey functions in MS-DOS command utilities such as edlin and debug.
FDISK /MBR Recreates the Master Boot Record See CH000175 for additional information.
FDISK /PRI See FDISK Page for additional information.
FDISK /EXT See FDISK Page for additional information.
FDISK /LOG See FDISK Page for additional information.
FDISK /Q Prevents fdisk from booting the system automatically after exiting fdisk.
FDISK /STATUS Shows you the current status of your hard drives.
FORMAT /AUTOTEST Formats the hard drive without any prompting.
FORMAT /BACKUP Like /AUTOTEST but it will ask you for a volume label.
FORMAT /Z:n Command used with FDISK supporting FAT32, used to specify the cluster size in bytes where n is multiplied by 512.
MEM /A or /ALL Adds a line into the MEM command tells the available space in HMA.
SET DIRCMD=0 Will make all directories hidden however still accessible, to get them back SET DIRCMD=
SHARE /NC Unknown
TRUENAME When placed before a file, will display the whole directory in which it exists.
VER /R Tells you the Revision and if DOS is in HMA.

Saturday, June 19, 2010

list of MS-DOS commands for hacking and its defence

there’s no replacement for the *nix shell for network based computing tasks, but Micro$oft still has its roots deep . For those who find working via the GUI meclancholy, here’s a list of DOS commands you might want to try out on your Windows machine. This can be useful for hackers, or anyone interested in churning out more information from the network.

ADDUSERS Helps Add or list users to/from a CSV file
ARP Address Resolution Protocol
ASSOC Change file extension associations
ASSOCIAT One step file association
AT Schedule a command to run at a later time
ATTRIB Change file attributes

BOOTCFG Edit Windows boot settings
BROWSTAT Get domain, browser and PDC info

CACLS Change file permissions
CALL Call one batch program from another
CD Change Directory - move to a specific Folder
CHANGE Change Terminal Server Session properties
CHKDSK Check Disk - check and repair disk problems
CHKNTFS Check the NTFS file system
CHOICE Accept keyboard input to a batch file
CIPHER Encrypt or Decrypt files/folders *
CleanMgr Automated cleanup of Temp files, recycle bin
CLEARMEM Clear memory leaks
CLIP Copy STDIN to the Windows clipboard.
CLS Clear the screen
CLUSTER Windows Clustering
CMD Start a new CMD shell
COLOR Change colors of the CMD window
COMP Compare the contents of two files or sets of files
COMPACT Compress files or folders on an NTFS partition
COMPRESS Compress individual files on an NTFS partition
CON2PRT Connect or disconnect a Printer
CONVERT Convert a FAT drive to NTFS.
COPY Copy one or more files to another location
CSVDE Import or Export Active Directory data

DATE Display or set the date
Dcomcnfg DCOM Configuration Utility
DEFRAG Defragment hard drive
DEL Delete one or more files
DELPROF Delete NT user profiles
DELTREE Delete a folder and all subfolders
DevCon Device Manager Command Line Utility
DIR Display a list of files and folders
DIRUSE Display disk usage
DISKCOMP Compare the contents of two floppy disks
DISKCOPY Copy the contents of one floppy disk to another
DNSSTAT DNS Statistics
DOSKEY Edit command line, recall commands, and create macros
DSADD Add user (computer, group..) to active directory
DSQUERY List items in active directory
DSMOD Modify user (computer, group..) in active directory

ECHO Display message on screen
ENDLOCAL End localisation of environment changes in a batch file
ERASE Delete one or more files
EXIT Quit the CMD shell
EXPAND Uncompress files
EXTRACT Uncompress CAB files

FC Compare two files
FDISK Disk Format and partition
FIND Search for a text string in a file
FINDSTR Search for strings in files
FOR Loop command: all options Files, Directory, List
FORFILES Batch process multiple files
FORMAT Format a disk
FREEDISK Check free disk space (in bytes)
FSUTIL File and Volume utilities
FTP File Transfer Protocol
FTYPE Display or modify file types used in file extension associations

GLOBAL Display membership of global groups
GOTO Direct a batch program to jump to a labelled line

HELP Online Help
HFNETCHK Network Security Hotfix Checker

IF Conditionally perform a command
IFMEMBER Is the current user in an NT Workgroup

KILL Remove a program from memory

LABEL Edit a disk label
LOCAL Display membership of local groups
LOGEVENT Write text to the NT event viewer.
LOGOFF Log a user off
LOGTIME Log the date and time in a file

MEM Display memory usage
MD Create new folders
MODE Configure a system device
MORE Display output, one screen at a time
MOUNTVOL Manage a volume mount point
MOVE Move files from one folder to another
MOVEUSER Move a user from one domain to another
MSG Send a message
MSIEXEC Microsoft Windows Installer
MSINFO Windows NT diagnostics
MSTSC Terminal Server Connection (Remote Desktop Protocol)
MUNGE Find and Replace text within file(s)
MV Copy in-use files

NET Manage network resources
NETDOM Domain Manager
NETSH Configure network protocols
NETSVC Command-line Service Controller
NBTSTAT Display networking statistics (NetBIOS over TCP/IP)
NETSTAT Display networking statistics (TCP/IP)
NOW Display the current Date and Time
NSLOOKUP Name server lookup
NTBACKUP Backup folders to tape
NTRIGHTS Edit user account rights

PATH Display or set a search path for executable files
PATHPING Trace route plus network latency and packet loss
PAUSE Suspend processing of a batch file and display a message
PERMS Show permissions for a user
PERFMON Performance Monitor
PING Test a network connection
POPD Restore the previous value of the current directory saved by PUSHD
PORTQRY Display the status of ports and services
PRINT Print a text file
PRNCNFG Display, configure or rename a printer
PRNMNGR Add, delete, list printers set the default printer
PROMPT Change the command prompt
PsExec Execute process remotely
PsFile Show files opened remotely
PsGetSid Display the SID of a computer or a user
PsInfo List information about a system
PsKill Kill processes by name or process ID
PsList List detailed information about processes
PsLoggedOn Who’s logged on (locally or via resource sharing)
PsLogList Event log records
PsPasswd Change account password
PsService View and control services
PsShutdown Shutdown or reboot a computer
PsSuspend Suspend processes
PUSHD Save and then change the current directory

QGREP Search file(s) for lines that match a given pattern.

RASDIAL Manage RAS connections
RASPHONE Manage RAS connections
RECOVER Recover a damaged file from a defective disk.
REG Read, Set or Delete registry keys and values
REGEDIT Import or export registry settings
REGSVR32 Register or unregister a DLL
REGINI Change Registry Permissions
REM Record comments (remarks) in a batch file
REN Rename a file or files.
REPLACE Replace or update one file with another
RD Delete folder(s)
RDISK Create a Recovery Disk
RMTSHARE Share a folder or a printer
ROBOCOPY Robust File and Folder Copy
ROUTE Manipulate network routing tables
RUNAS Execute a program under a different user account
RUNDLL32 Run a DLL command (add/remove print connections)

SC Service Control
SCHTASKS Create or Edit Scheduled Tasks
SCLIST Display NT Services
ScriptIt Control GUI applications
SET Display, set, or remove environment variables
SETLOCAL Control the visibility of environment variables
SETX Set environment variables permanently
SHARE List or edit a file share or print share
SHIFT Shift the position of replaceable parameters in a batch file
SHORTCUT Create a windows shortcut (.LNK file)
SHOWGRPS List the NT Workgroups a user has joined
SHOWMBRS List the Users who are members of a Workgroup
SHUTDOWN Shutdown the computer
SLEEP Wait for x seconds
SOON Schedule a command to run in the near future
SORT Sort input
START Start a separate window to run a specified program or command
SU Switch User
SUBINACL Edit file and folder Permissions, Ownership and Domain
SUBST Associate a path with a drive letter
SYSTEMINFO List system configuration

TASKLIST List running applications and services
TIME Display or set the system time
TIMEOUT Delay processing of a batch file
TITLE Set the window title for a CMD.EXE session
TOUCH Change file timestamps
TRACERT Trace route to a remote host
TREE Graphical display of folder structure
TYPE Display the contents of a text file

USRSTAT List domain usernames and last login

VER Display version information
VERIFY Verify that files have been saved
VOL Display a disk label

WHERE Locate and display files in a directory tree
WHOAMI Output the current UserName and domain
WINDIFF Compare the contents of two files or sets of files
WINMSD Windows system diagnostics
WINMSDP Windows system diagnostics II
WMIC WMI Commands

XCACLS Change file permissions
XCOPY Copy files and folders

This list is not exhaustive . Most commands will work well, however please don’t fume up as some of these might not work on your machine due to version dependencies

Friday, June 18, 2010

Use of MS DOS Commands:

In this age of Windows, we do not use MS-DOS Commands in day-to-day use, but the system administrators or network people need to use these commands frequently.

For common people, when there is a virus attack on the system or system gets corrupted and they need to format the hard disc or reinstall the operating system, then MS DOS Commands prove very useful. You can access the drives of your hard disc and run set up, find keys or save your valuable data using these commands very easily.

Thursday, June 17, 2010



MS DOS Commands stands for Microsoft Disk Operating System Commands written by Microsoft Corporation, USA. It is useful for smooth function of a computer System. CPU is (Central Processing Unit) the heart of the Computer Hardware. Operating system is the heart of the computer software.

DOS and its components:

DOS Commands have been broken up into three parts.

The first part of the operating system is in two files at the beginning of the storage area on the disk. The first file is the IO.SYS. It deals with the Input/output tasks to the base devices.

The second hidden file is MSDOS.SYS. It is the program that interacts with the user. It operates by communicating directly with the IO.SYS or the MSDOS.SYS files.

MS DOS commands are mainly categorized under two heads; Internal commands or Resident Commands and External Commands and External commands or Transient commands.

Internal Commands: - An Internal command is a part of the operating system. Therefore, this sort of commands is not a separate file on the disk and can be accessed at any time. That is, as long as COMMAND.COM i.e. the command processor that has been load on.

External Commands: - An External Command is a file or a program that is on the disk (usually under the DOS directory) and if not present, that command cannot be executed.

We shall first have a look at a few of the internal commands and then go on to the External commands.


1) DIR:-

DIR command and be used to list the contents of the current directory or specified directory and its subdirectories.

E.g. DIR

The directory display includes the filename, the file’s size in bytes, the date and the file was updated, and the amount of free space remaining on the disk. DIR command displays the names of directory entries except those whose attributes mark them as hidden or system.

Sometimes you want to look at only those directory entries that have, or do not have. Certain attributes, to do this /A (attribute) option is available.

E.g. DIR/A

It displays all files including hidden and system files. One or more letter can be used with /A attribute for following requirements.


D It displays subdirectories only.
R It displays read-only files.
H It displays Hidden files.
S It displays System files.
A Files ready to archive.
- If preceding an attribute, means do not display files with this attribute.

E.g. DIR/A-D

It displays files only.

/0 attribute displays files sorted. By default, it will sort on name if no order is specified. All sorts are in ascending order unless preceded by the character in which case the sort reversed.

Order Meaning
DIR/N By name (default if no order is specified)
DIR/S By size.
DIR/E By Extension.
DIR/D By date and time.
DIR/G Group directories first.
- Perform sort in descending order.
DIR/S Displays files in specified directory and all subdirectories
DIR/L Displays list in lower-case (default is uppercase)
DIR/P Pause display after each screenful
DIR/W Display files in wide format (without any file details and four filename a line)

Most of the commands in DOS operate on files. Files have names to identify them from the others. Hence, filenames should be unique within the current directory.

When we give command using a filename, we can only manipulate that file alone. Can we operate on a group of files rather than a single file? Yes, DOS, allows us to do this also. If we want all filenames which contain certain specified characters, we can replace the bother characters by a special character. These special characters are termed as replacement characters or wild characters. While matching. DOS ignores those characters in actual filenames, where these special characters have been specified.

The following are wild characters used and their characteristics:


Wherever * occurs in primary name or extension it specifies all the characters to be ignored.

E.g. i) DIR*.*

After the command has been executed all files on the floppy will be listed.

ii) DIR RP*.*

On execution of this command all files that begin with RP will be listed.

iii) DIR *.A

All files with the extension A will be listed.


The location where “?” occurs in a filename will be ignored.

E.g. i) DIR ??P??A.??E

All the files which meet the following particulars would be listed:

a. The primary name should contain only 6 characters.
b. The 3rd character should be “P”
c. The 6th character should be “A”
d. The secondary name should contain 3 characters.
e. The 3rd character in the secondary name should be “E”

ii) DIR ?.?

since ? is a single replacement character, all files having filename and extension with single character each, will be listed.

iii) DIR A?.EXE

All files with two letters in the primary name which begin with A and have an extension EXE will be listed.

iv) DIR ?A?.*

File name width should be of three characters.
Middle character should be ‘A’.
Extension may be any thing will be listed.

3> MKDIR or MD :-

To create a new directory, you use the make directory command.
It is typed either as MKDIR or MD. E.g. you would add a directory named LETTERS to the root directory with this command.


Every directory or sub-directory contains two special files (.) and (...). These are the system files.

In directory other files or directories can be placed. Within particular disk or partition, all of the names in one directory names of files, or names of subdirectories – must be unique. But the same name can be used in other directories.

4> CHDIR or CD

When you start DOS. You’re in the root directory. In other words, root directory is the current directory. Even though you have made sub-directories, you have not changed the current directory yet. We can enter the sub-directories by using CHDIR command. CHDIR is used to change the current directory to the one you want to work in or to display its path.

When CHDIR or CD is entered without any parameters, the path of the current directory is directory is displayed. When a directory name is specified after CHDIR or CD, the current directory will change to the sub-directory from its current directory. E.g.

cd invfile

In the preceding example, the CHDIR command will chance the current directory to INVFILE.

CD/ A - This command will change the direction to the root directory from any sub-directory.

CD.. - This command will change the directory to the parent sub-directory.

5> RMDIR or RD :-

With this command directory can be removed. E.g.


To be able to use this command on a directory. The directory must first be empty. It should contain no files or any other directory entries. If you try to delete a directory that contains any files or subdirectories. DOS display the informative message :-


6> CLS :-

This is an easy command to remember. It everything from the screen and moves cursor to the top left hand corner of the screen, right after the prompt.

7> COPY :-

Makes a copy or duplicates a file or files from one location to another.

In this example DOS tells to copy a file named THISFILE from the diskette in drive A to the diskette in drive B:

b) COPY A:*.* B:
It copies all the files from drive A to drive B.
You can use both characters and wild cards in a file name E.g. You could copy all the files that begin with the letters XYZ like this

Following is the basic form of copy command
COPY drive:filename drive:


Here the first file specified is the source file. The second file specified is the target file. It would make a copy of a file name THISFILE, and the copy would be named THATFILE at the same disk or drive. If you want to copy it from drive A to B following is the command


d) Suppose you have two files. XX & YY and you want to combine their contents into another file ZZ then following is the command


8> DEL or ERASE :-

If you can duplicate files with copy, you can intentionally removes files as well. So it deletes one or mare files.

a) You can delete all the files using wildcard E.g. DEL *..
Dos will ask – are you sure (Y/N) ?
This is the protective side that, DOS ask you question if you mistakenly gives the command

This will delete all the files having the extension BAK

The above command deletes the file THISFILE.

9> RENAME or REN :-

This command is useful to change the name of a file. REN, short for RENAME. So the format is

REN old-name new-name

a> E.g. you had a file named DRAFT and you wanted to change the name to FINAL
then:- RENAME DRAFT FINAL is the command.

b> E.G. Like other commands, you can use wildcards :-
You could change every file with an extension of XXX to YYY.

10> DATE:-
The DATE command is used to enter or change the system date. This date is recorded in the directory entry for any files which are either created or modified.

E.g. date

The following message is displayed

Current date is (Tue 1-07-1980)

Enter new date (mm-dd-yy):

Valid entry for date is mm-dd-yy, where mm is for month, dd for date, yy is for year. Valid month are from 01 to 12, and valid dates are from 01 to 31.

An invalid entry will result in the following message

Invalid date

Either the hyphen (-) or the slash (/) can be used while entering the date.

11> TIME :-

The TIME command allows the user to change system time.

E.g. time

The following message is displayed:

Current time is (hh:mm:ss:fs:)
Enter new time (hh:mm:ss:fs)

Valid format for entering time is
hh = hours ranging from (01-24)
mm = minutes ranging from (00-59)
ss = second ranging from (00-59)
fs = fractions of seconds


The colons separate the hours, minutes, and seconds while a period separates seconds and fractions of seconds.

12> TYPE:-

Type is handy way to get a quick look at the contents of a file on the screen. The output can also be directed to the printer if required.


This will display the contents of the fie ABC.TXT

13> VER (Version):-

Displays the current version and revision of DOS begin run. A message usually appears when the command processor loads on. VER/R – The /R switch also gives a bit of information about where DOS has been loaded like CLS, VER easy to use. Just enter and you will get the message MS-DOS Version 6.2
Revision A
Dos is in HWA

MS DOS Commands have been revised or changed a number of times. Each revision has a version number assigned to it, so with this command current version can be identified.

14> PATH:-

Sets or resets an environment variable that is used to state alternate search directories for files. If path is specified at the DOS, the current contents of PATH are displayed.
E.g. DW5PG.COM is program and it resides in the c:\DW\DW5PG or you can change directories before starting the program.

Set path = C:\DOS;C:\BATCH;C:\BIN
The path variable is begin set in the above example.

15> PROMPT:-


On execution of this command, the DOS prompt tells you which directory you are in, i.e. current directory. If you are in sub-directory or any level of sub-directories, this command will display the path i.e. drive, backslash root and the names if the sub-directories till its current sub-directory. It is used to change the DOS prompt.

$ Displays $ (dollar sign)
b Displays (vertical bar)
d Displays system date
g Displays > (greater than)
h Back spaces (erase previous character)
l Displays < (less than) n Displays default drive letter p Displays default drive and directory path name q Displays = (equal sign) v Displays DOS version number t Displays the system time Command Results Displayed Prompt A> (disable the current drive)
Prompt command? Command?
Prompt $p$q A:\= , A:\WP=
Prompt $P$G A:\> , A:\WP>
Prompt $p$d$t$g A:\Fri 01-01-1997 11:05:32>
A:\ss\Fri 01-01-1997 11:05:32>
Prompt $l$p$g

Prompt $p : command? A:\123:command?

16> SET:-

It will show, set or reset a DOS variable.

Syntax : SET [Varname = [string]]

Varname - is name of the variable that is to be set or reset

String - is what the variables to be set to
Here ABC is variable and HELLO is the string assigned
The path variable is begin set in the above example.

17> VERIFY :-

When DOS is writing information to disk, it normally accepts the disk drive’s report that all went well. If you wish, you can ask DOS to check, or verify, all data that is written to disk. This is controlled with VERIFY command. Which can set verification on or off.

VERIFY ON – Verification on
VERIFY OFF-Verification off

If you want to find out the current status of VERIFY, then enter the command itself. Being able to turn it on and off, because you may not want to have verification in action all the time.

This concludes internal commands part of MS DOS Commands. Now, we will have a look at external commands.


EXTERNAL COMMANDS: External commands are carried out by separate programs, one program for each command. E.g. the FORMAT command is carried out by the FORMAT.COM program. When you install DOS, all of these programs are copied to your hard disk.

1> CHKDSK (Check Disk) :-

DIR command shows us a list of the files on a disk. The CHKDSK command gives us status report of the disk. First, it checks the disk over to see how much free space is available and how much is in use, and to see if there is any discrepancy in the space usage. It then reports the total space in use, the number of files and incidentally, whether there are any hidden files.

To use CHKDSK, enter the command followed by the name of the disk you want to check. For example:


So the CHKDSK gives following report :



On the first line we see the volume label of the disk. It specifies when we format the disk and it can be changed with the LABEL command. Next we see the date and time that the volume was created-that is, when the disk was formatted. The second line shows the volume serial number that was assigned by the FORMAT program.

Next, we see the total amount of space on the disk and a breakdown of how this space is being used.

If the above command is used without specifying the names of the disk default disk will be checked.


Any disk that is used with a computer requires to be formatted first. This command will divide the floppy into tracks and sectors. The file FORMAT.EXE has to be present for executing this command. A format is a method in which the data can be recorded in a recognizable manner. FORMAT actually does tow important things with a diskette, it draws the electronic “lines” that make it possible for DOS to work with the diskette and it checks for any defects in the diskette. When FORMAT finds bad patches, it reports them to you, indicating their size as well as the size of the usable part of the diskette. Once this is done, the rest of the diskette is ready to use.


When the FORMAT command is issued. The following message is displayed:

Insert new diskette for drive A:
And press ENTER when ready…

You are required to press the ENTER Key to begin the formatting.

FORMAT is one of the most dangerous command in DOS because it can wipe out an one. Be very careful when you format diskettes.

3> TREE:-

The file TREE.COM has to be present for executing this command.
This command displays all the directory paths found on the specified drive. It displays a tree-like structure with branches and files contained in each if required.

E.g. TREE C:\


The following message appears “Insert Source diskette, Press any key to continue”.

Ensure that the diskette from where the contents are to be copied is inserted as the source diskette. To make sure that the source diskette is not overwritten by error, write-protect the floppy-i.e. one can only read this floppy. For a 3.1/2” diskette, it is done by pushing up the black button on the floppy and a square hole is visible.

For a 5.1/4” floppy there is a notch on the left side of the floppy. If the notch is covered with a silver rectangular piece called read/write label the floppy is write protected.

The computer reads form the floppy, stores it in the RAM and asks for the target diskette. Now remove the source diskette and insert the diskette on to which you would like the contents to be written. Make sure your target diskette is not write protected. Report the process of inserting and removing the two diskettes till the DISKCOPY is finished and the following message will be displayed:

Copy another diskette – (Y/N)

If N is entered, DISKCOPY will be ended. If Y is entered, another copy operation will be performed as above.

5> DISKCOMP (Disk compare) :-

When you make copies of files or disks, you may need to confirm that the copy is accurate. The DISKCOMP command lets you compare entire diskettes to see if they match exactly. DISKCOMP is primarily useful as a means of verifying the results of a DISKCOPY, because DISKCOMP will report two diskettes as being different even if they contain the same data and are functionally equivalent but differ in some minor way. Such as the order the data is stored in.

The DISKCOMP command is easy to understand and use. To use it, you enter the command name. Followed by the drive specifications of the two diskettes. Both diskettes are read from front to back and compared: any differences are reported. E.g.


You can use both A: and B: even if you have only one diskette drive. DOS will use your single drive to simulate two drives and will tell you when to switch the diskettes.

As DISKCOMP compares the two diskettes, it tells you the locations of any differences it finds with messages like this:


6> BACKUP :-

BACKUP is designed to copy your data from a hard disk to as many diskettes as are needed to hold them. The file BACKUP.EXE has to be present for execution of the command. You can use BACKUP to copy from any type of disk to any other and you can even back up your diskettes into a hard disk.

If you want to copy entire contents of a hard disk (assume drive c) onto diskettes (assume they are placed in drive A), then you use the BACKUP command like this :

The parameter C:\ instructs BACKUP to start from the root directory of drive C. The /S switch tells BACKUP to copy all the subdirectories as well as what is in the root directory that is all the files.

If one floppy is full it will keep some kind of continuation mark called control data and will ask for the next floppy and the procedure will continue till all data has been backed up.


RESTORE reverses the backup operation and has the same sort of features. It will only restore files to exactly the same directories from which they were backed up.

As a general rule. When you save files using BACKUP, you should use the RESTORE from the same version of DOS.


You tell DOS what disk holds the backup file and which files want to restore. In this case. We have told DOS to restore all the files from the diskette in drive A.


There are many ways that your disk data can be lost or damaged and the whole subject of data recovery is an important one. If part of a disk has been damaged so that a file can be partially read or partially not, the RECOVER command will remove the unreadable part so that you can use rest. Depending upon the kind of file it is, the recovered portion may or may not use usable. Generally, this kind of file recovery only works with ASCII text files which contain written material. To use RECOVER in this way, you enter the command followed by the name of the file it is to check for readable and unreadable parts.

The other kind of file recovery done by RECOVER is completely different and confuse with the first one and so danger lies here. Here RECOVER assumes that the entire directory of the disk is damaged and nonessential. It throws away the entire directory and replaces it with a new one.

To use RECOVER in this way, you enter the command without specifying any file name. sut remember that this form of RECOVER wipes out your entire directory. So be careful before you use it. Completely avoid the use of RECOVER command, for safety’s sake.


To unerase a file, use the UNDELETE command, followed by the name of the file you want recover. E.g.


If it is possible to unerase the file. DOS will ask your permission. You should answer yes.

Unreasing is straightforward. Other than specifying the name of a single file. You can specify a collection of files :


If you specify the name of a directory :

Dos will try to unerase all the deleted files in that directory.
If you use UNDELETE without a file name :


Dos will try to unerase all the deleted files in the current directory.

If you want to check what files can be unerased without actually committing yourself, use the /LIST option.


UNFORMAT will attempt to undo the work of a previous FORMAT command. However, you will lower your chances of successful recovery if you have used the disk to store any new data. So when you find you accidentally formatted a disk, stop whatever you are doing and run UNFORMAT immediately.

With UNFORMAT command you need to specify the name of the disk you want to unformat :


11> DOSKEY :-

The roll of this command is to let you recall a DOS command, edit it and then re-enter it. DOEKEY command available with DOS 5.0 or later. The line that you are currently typing called the command line. DOS maintains the command line, interpreting each key as you press it. With DOSKEY.DOS also keeps a list of all your previous commands, called the history list.

If you are using DOSKEY.DOS copies commands to the bottom of the history, list. So DOSKEY recalls data from the history list. To recall command you have to use arrow key.

12> ASSIGN :-

ASSIGN instructs DOS to reroute requests for one disk drive to another, essentially “pretending” that drive X is really drive Y. following is the form of assign command :

ASSIGN olddrive =newdrive

You can assign several drives at the same time if you want to. E.g. if you want to assign drives A and B to your hard drive, C the command is :


To undo the assignment just issue the ASSIGN command with no parameters, so that program references to A and B go where they were originally intended.


13> ATTRIB :

This command lets the user set, remove or display the attributes of all the file in a specified directory. This command can offer a certain amount of protection to the file.

To turn on an attribute, use a plus sign (+) followed by a single letter R.A, S or H. and specify the file you want to effect. The meanings are as follows :

+R make the file read-only
+A make the file as needing archiving
+S make the file a system file
+H make the file hidden.

E.g. let’s say that you have a very important file, DATA.NEW. and you want to make sure that you do not accidentally change or erase it. You can make the file read-only by using :


ATTRIB will recognize wildcards. E.g. to turn on the archive attribute for all the files in the \DOCUMENT subdirectory, use :


If you do not specify a file name. ATTRIB will act on all the files in the current directory. E.g. to make all files in the current directory. E.g. to make all files in the current directory read-only, you can use either of the following two commands :


If you want to turn off a particular attribute, just use a minus sign instead of a plus sign. E.g. you decide to delete the file DATA.NEW but you cannot because it is read-only. To turn off the read-only attribute, use :


You can now delete the file.

14> FIND :-

The FIND filter is used to identify the lines of data that have, or don’t have. Some particular data on them. To use FIND, you must specify what you are looking for, enclosed in double-quotes. FIND filters out the lines that don’t contain what you are looking for, and only passes on the lines that do. For example :


As you might expect, FIND has some switches: the /V switch reverses the search so that lines with the specified information are filtered out and the others are passed through. The /N switch adds in the relative lines numbers ( Which can help you know where the data was found). The /C switch gives a count of the lines found, without passing any other data on.

Following is the example of /V. Here you want to find a file that contains the letters FIL, somewhere in the file name. FIND command with combination of CHDSK is useful for a complete list of files.


Here is some sample output :


Following is the example of /N.

Here ABC is the filename. TYPE command use to display the contains. FIND with parameter /N use to display then line number where the data was found. So following is the output :


here data was found at line number one.

15> LABEL :-

If you have a formatted disk which does not have a volume label. You can’t use the FORMAT command to give it a volume label, because formatting would destroy your data. In this case LABEL command. Including drive specification if necessary can be use:

And LABEL’S response looks like this:


If you want to change the existing volume label called REPORT to ACCOUNT, place the diskette in drive A and enter :


The command responds :


You can now type the name ACCOUNT and press . The diskette now has a new volume label. You can check it :


You will see :


You can also remove a disk’s volume label, replacing it with nothing, again type LABEL A: and see the same display as before. This time press only and the command responds :

DELETE CURRENT VOLUME label is removed.

If you press Y, the volume label is removed.

16> MEM :-

MEM will tell you about the memory in your computer.


It shows summary that looks like this :



In this example computer has 8 megabytes, about 8.4 million bytes.

17> MODE :-

MODE allows the user to configure the system devices. It is a complex command with seven options. You can use MODE to :

* Set the characteristics of a parallel printer port.
* Set the characteristics of a serial port.
* Display the current status of various hardware devices.
* Redirect parallel printer output to a serial devices.
* Control code page support (for non-English languages).
* Configure the display , including the number of lines.
* Set the automatic repeat rate for the keyboard.


a) BW means black and white.
b) 80 stands for 80 characters to be displayed on the screen.

18> MORE :-
When you have information displayed on the screen, there is often more than can fit onto the screen at one time, and some of it may roll off the top of the screen before you get a chance to study it. The MORE filter is designed to display only as many lines of information as will fit onto your computer’s screen, and the press enter to indicate that you are ready to see more. MORE is only used at the end of a pipeline.

To display a long directory listing one screenful at a time, you could enter :

The most common use of the MORE filter is to process the output of a TYPE command that is displaying a long file :


This keeps the output form scrolling off your screen faster than you can read.

19> PRINT :-

PRINT command prints a text file while you are using other MS-DOS commands. This command can only be used to print textfiles. Other files cannot be printed with this command. The PRINT command loads itself into memory, and stays there until the computer is turned off or reset. From then on. Any time you invoke the PRINT command, you just tell it what you want it to do.

To get printed information give the name of the file followed by the PRINT command.

If you want, you can specify the name of more than one file. DOS will print them in the order you .specify. E.g.

20> SORT :-

It is much easier to locate anything if it is put in order. This task is handle by the SORT command. It cannot be executed with no parameters at all. There has to be some input given to the program. In other words, SORT requires to have something to sort. SORT like other DOS commands, does not differentiate between upper and lower case. So A and a are exactly the same. SORT treats each line of data as a separate entity, and so it is the order of the lines of data that SORT rearranges. Normally SORT arranges the lines in first to last order. But a switch /R. will make the sort work in reverse order.


The file ABC.TXT is sorted line-by-line and the output is sent to the standard output devices. The output could be directed to a printer or another file if required.
A common example of the use of SORT, is with the DIR directory command.


This command will sort the files into order by name.

By using the/+n switch to shift to shift the sorting over to the column where the file size is displayed, you can get the list in order by size :


21> XCOPY :-

This command used to copy multiple files and directories in one go. A number of files are read at once and copied to the destination. It is more powerful than COPY command.

XCOPY, like COPY also does warn if a file already exists before a copy is made. XCOPY will copy groups of files including a whole tree structure of files. XCOPY , the source of copying can be all the files in a directory tree and XCOPY will duplicate that directory tree on the target disk.

The basic form for XCOPY is this :

XCOPY source target

The source and target specifications can be either file specifications or directory path specifications. All the various rules for the copy command like wildcard file names. Target names different than source names, etc. can be use with this command.


$$$ Temporary work file.
ASM Assembly source.
BAK Text file back-up copy.
BAS Basic source code.
BAT Batch processing file.
COB COBOL source file.
COM Executable programs, in memory-image format.
DAT Data files, in general.
DBF Used by DBASE.
DOC Word-processing document.
EXE Executable programs, in relocation format.
FMT Used by Dbase.
FOR FORTRAN source code.
LBL Used by Dbase.
LIB Library routines, for compilers.
LST Printable listing files, in general.
NDX Used by Dbase.
OBJ Program object code, from compilers.
PAS Pascal source file.
TXT Text files. For word processors.
WK1 Lotus worksheet for 1-2-3, version 2
WKS Lotus worksheet for 1-2-3, version 2
WRK Lotus worksheet for Symphony.


Wordstar 4.0 is a software package that enables you to perform both simple and complex word-processing tasks.

“Word processing”, in computer terminology, refers to the typing, ending and formatting of any kind of document, which could be a letter, a memorandum, a balance sheet or something similar. As the term suggests, a word processor simply processes words, that is, textual information. You can use it to print letters, reports, booklets, and so forth, in a layout you desire. This the word processor does by simply formatting the information you or somebody else has keyed into the computer. (keying information into a computer is a process similar to typing.)

Word processing is different from conventional typing in many ways. Here the document is not printed while being keyed-in, However, its image is displayed on the computer screen (similar to a TV screen), and the information you enter is also stored in the computer memory. The computer operator memory.

Wednesday, June 16, 2010



ANSI.SYS Defines functions that change display graphics, control cursor movement, and reassign keys.
APPEND Causes MS-DOS to look in other directories when editing a file or running a command.
ARP Displays, adds, and removes arp information from important]devices[.
ASSIGN Assign a drive letter to an alternate letter.
ASSOC View the file associations.
AT Schedule a time to execute commands or programs.
ATMADM Lists connections and addresses seen by Windows ATM call manager.
ATTRIB Display and change file attributes.
BATCH Recovery console command that executes a series of commands in a file.
BOOTCFG Recovery console command that allows a user to view, modify, and rebuild the boot.ini
BREAK Enable / disable CTRL + C feature.
CACLS View and modify file ACL's.
CALL Calls a batch file from another batch file.
CD Changes directories.
CHCP Supplement the International keyboard and character set information.
CHDIR Changes directories.
CHKDSK Check the important harddisk
running FAT for errors.
CHKNTFS Check the hard disk drive running NTFS for errors.
CHOICE Specify a listing of multiple options within a batch file.
CLS Clears the screen.
CMD Opens the command interpreter.
COLOR Easily change the foreground and background color of the MS-DOS window.
COMMAND Opens the command interpreter.
COMP Compares files.
COMPACT Compresses and uncompress files.
CONTROL Open control panel icons from the MS-DOS prompt.
COPY Copy one or more files to an alternate location.
CTTY Change the computers input/output devices.
DATE View or change the systems date.
DEBUG Debug utility to create assembly programs to modify hardware settings.
DEFRAG Re-arrange the hard disk drive to help with loading programs.
DEL Deletes one or more files.
DELETE Recovery console command that deletes a file.
DELTREE Deletes one or more files and/or directories.
DIR List the contents of one or more directory.
DISABLE Recovery console command that disables Windows system services or drivers.
DISKCOMP Compare a disk with another disk.
DISKCOPY Copy the contents of one disk and place them on another disk.
DOSKEY Command to view and execute commands that have been run in the past.
DOSSHELL A GUI to help with early MS-DOS users.
DRIVPARM Enables overwrite of original
ECHO Displays messages and enables and disables echo.
EDIT View and edit files.
EDLIN View and edit files.
EMM386 Load extended Memory Manager.
ENABLE Recovery console command to enable a disable service or driver.
ENDLOCAL Stops the localization of the environment changes enabled by the setlocal command.
ERASE Erase files from computer.
EXIT Exit from the command interpreter.
EXPAND Expand a file back to it's original format.
EXTRACT Extract files from the Microsoft Windows cabinets.
FASTHELP Displays a listing of MS-DOS commands and information about them.
FC Compare files.
FDISK Utility used to create partitions on the hard disk drive.
FIND Search for text within a file.
FINDSTR Searches for a string of text within a file.
FIXBOOT Writes a new boot sector.
FIXMBR Writes a new boot record to drive
FOR Boolean used in batch files.
FORMAT Command to erase and prepare a disk drive.
FTP Command to connect and operate on a server.
FTYPE Displays or modifies file types used in file extension associations.
GOTO Moves a batch file to a specific label or location.
GRAFTABL Show extended characters in graphics mode.
HELP Display a listing of commands and brief explanation. <<<<<<<<<<<<<<<<
IF Allows for batch files to perform conditional processing.
IFSHLP.SYS 32-bit file manager.
IPCONFIG Network command to view network adapter settings and assigned values.
KEYB Change layout of keyboard.
LABEL Change the label of a disk drive.
LH Load a device driver in to high memory.
LISTSVC Recovery console command that displays the services and drivers.
LOADFIX Load a program above the first 64k.
LOADHIGH Load a device driver in to high memory.
LOCK Lock the hard disk drive.
LOGON Recovery console command to list installations and enable administrator login.
MAP Displays the device name of a drive.
MD Command to create a new directory.
MEM Display memory on system.
MKDIR Command to create a new directory.
MODE Modify the port or display settings.
MORE Display one page at a time.
MOVE Move one or more files from one directory to another directory.
MSAV Early Microsoft Virus scanner.
MSD Diagnostics utility.
MSCDEX Utility used to load and provide access to the CD-ROM.
NBTSTAT Displays protocol statistics and current TCP/IP connections using NBT
NET Update, fix, or view the network or network settings
NETSH Configure dynamic and static network information from MS-DOS.
NETSTAT Display the TCP/IP network protocol statistics and information.
NLSFUNC Load country specific information.
NSLOOKUP Look up an IP address of a domain or host on a network.
PATH View and modify the computers path location.
PATHPING View and locate locations of network latency.
PAUSE Command used in batch files to stop the processing of a command.
PING Test / send information to another network computer or network device.
POPD Changes to the directory or network path stored by the pushd command.
POWER Conserve power with computer portables.
PRINT Prints data to a printer port.
PROMPT View and change the MS-DOS prompt.
PUSHD Stores a directory or network path in memory so it can be returned to at any time.
QBASIC Open the QBasic.
RD Removes an empty directory.
RECOVER Recovers readable information from a bad or defective disk.
REM Records comments (remarks) in batch files or CONFIG.SYS.
REN Renames a file or directory.
RENAME Renames a file or directory.
REPLACE Replaces files.
RMDIR Removes an empty directory.
ROUTE View and configure windows network route tables.
RUNAS Enables a user to execute a program on another computer.
SCANDISK Run the scandisk utility.
SCANREG Scan registry and recover registry from errors.
SET Change one variable or string to another.
SETLOCAL Enables local environments to be changed without affecting anything else.
SETVER Change MS-DOS version to trick older MS-DOS programs.
SHARE Installs support for file sharing and locking capabilities.
SHIFT Changes the position of replaceable parameters in a batch program.
SHUTDOWN Shutdown the computer from the MS-DOS prompt.
SMARTDRV Create a disk cache in conventional memory or extended memory.
SORT Sorts the input and displays the output to the screen.
START Start a separate window in Windows from the MS-DOS prompt.
SUBST Substitute a folder on your computer for another drive letter.
SWITCHES Remove add functions from MS-DOS.
SYS Transfer system files to disk drive.
TELNET Telnet to another computer / device from the prompt.
TIME View or modify the system time.
TITLE Change the title of their MS-DOS window.
TRACERT Visually view a network packets route across a network.
TREE View a visual tree of the hard disk drive.
TYPE Display the contents of a file.
UNDELETE Undelete a file that has been deleted.
UNFORMAT Unformat a hard disk drive.
UNLOCK Unlock a disk drive.
VER Display the version information.
VERIFY Enables or disables the feature to determine if files have been written properly.
VOL Displays the volume information about the designated drive.
XCOPY Copy multiple files, directories, and/or drives from one location to another.

Tuesday, June 15, 2010

Contact Us

Related Posts Plugin for WordPress, Blogger...