Computer Practical

Download as pdf or txt
Download as pdf or txt
You are on page 1of 26

P1: A program to find the area of the triangle.

FORMULA: Area of triangle is ½ x base x height.


Here in this program we that variable b as base and h as height. T is the variable to store the result and print it.
CLS
INPUT ” Enter the base” ;b
INPUT ” Enter the height” ;h
LET T = 1/2*b*h
PRINT” The area of triangle=” ;T
END
P2: A program to find the area of the circle.
FORMULA : Area of a circle is 22/7 x radius^2. Here we use variable R as Radius. And C is the variable where we store the result.
CLS
INPUT” Enter the radius ” ;R
LET C=22/7*R^2
PRINT ” The area of circle =” ;C
END
P3: A Write a program to find the area of the square.
FORMULA: Area of a square is = Side2 square units. Here the result is stored in variable “square”.
CLS
INPUT” Enter the number” ;n
LET square= n^2
PRINT” The area of square=” ;Square
END
P4: A Write a program to find the volume of the box.
FORMULA: Area of a box = length x breadth x height.
The variable are l, b , and h for length, breadth and height and the result will be stored in the variable volume.
CLS
INPUT ” Enter the length ” ;l
INPUT ” Enter the breadth ” ;b
INPUT ” Enter the height ” ;h
LET volume= l*b*h
PRINT” The volume of box =” ;volume
END
P5: A Write a program to find the circumference of the circle.
FORMULA : circumference = 22/7 x Radius x 2
CLS
INPUT” Enter the radius ” ;R
LET Circumference=22/7*R*2
PRINT ” The area of circle =” ;Circumference
END
P6: A program to find out the simple Interest and the Amount.
FORMULA : Simple Interest = Principle x Rate x Time / 100
Amount = Principle + Simple Interest
CLS
INPUT ” Enter the Principal”;P
INPUT ” Enter the Rate”;R
INPUT ” Enter the Time”;T
LET I = P*T*R/100
LET A= P + I
PRINT ” The simple Interest = “;I
PRINT ” The amount=”;A
END
Pr 1: Introduction to DOS Command
When we start MS-DOS, we get a symbol on the screen like this
C:\>
This symbol is known as C drive or C-prompt. similarly A:\> is called A-prompt or A drive. Generally A:\ is used as
floppy drive i.e. when we are working on floppy disk and C:\ is used for local disk or hard disk. A small blinking bar
we see on the screen. This is cursor. It is waiting for your instruction. There few predefined words for DOS. These
are known as DOS-Commands. Our operating system can understand only these predefined commands.
These DOS-Commands are divided into two parts.
Internal Commands External Commands
A file may be known as container of information on a particular topic. A directory may be considered as a structure
or a cabinet which keeps one or more files.
Directories are usually creates for keeping one or more identical files together. Every file have a filename which
helps to recognize them. these are divided into two parts
File name or Primary name
Extension or Secondary name
The primary name can be from 1 to 8 characters long. The extension contains 1 to 3 characters long. A filename and
extension are separated by using a dot symbol. Thus it's structure looks like

Filename . Extension
Primary name . Secondary Name
The command available are all combined together and are stored in Command.com file, which is a executable
command file. These internal command are further grouped according to their properties. These are as follows.

Genral purpose File related commands Directory related commands

1. CLS
7. COPY CON
2. DIR
8. TYPE 12. MD
3. VER
9. COPY 13. CD
4. VOL
10. REN 14. RD
5. DATE
11. DEL
6. TIME

Pr 2: DOS- General purpose commands


General purpose commands
1. CLS:- (Clear the screen) This command is used to clear the screen or wipe out every thing written on the screen.
Syntax:- C:\> CLS and press Enter
2. DIR:- (Directory) Dir command is used for listing files and directories present in the current disk.
Syntax:- C:\> DIR [/switches]
Example:- C:\> DIR /P
Switches:-
/P Page wise
/W Widths wise
/S List all files and directory of subdirectories
/AH Display directory with hidden files
/AS Display directory with system files
/AD Display only directories present in current drive
3. VER:-(Version) Version numbers indicates that which edition of DOS we are working on.
Syntax:- C:\> VER press enter
Output:-
C:\>VER
Windows 98 [Version 4.10.2222]
4. VOL:-(Volume) Displays the disk volume label and serial number, if it exist.
Syntax:- C:\> VOL press enter
Output:-C:\>VOL
Volume in drive C is ANC
Volume Serial Number is 3E42-1907
5. DATE:- Display the current Date
Syntax:- C:\> DATE
C:\>DATE
Current date is Fri 02-15-2002
Enter new date (mm-dd-yy):
Type DATE without parameters to display the current date setting and
a prompt for a new one. Press ENTER to keep the same date.
Note:- We enter new date in the format of MM-DD-YY.
6. TIME:- Display current time
Syntax:- C:\> TIME
C:\>TIME
Current time is 8:38:47.70a
Enter new time:
Type TIME with no parameters to display the current time setting and a prompt for a new one. Press ENTER to
keep the same time.
Note:- We enter the time in the format of 24 hour clock.
File related commands
7. COPY CON:- This command gives the facility to create a new text file.
Syntax:- C:\> COPY CON <Filename>
C:\>COPY CON Rose.txt
A clock in a office can never get stolen
Too many employees watch it all the time
^Z
1 file(s) copied
After copy con we must specify a suitable file name. Press enter. Start typing the informations of the file. After
gathering the information we press ^Z (CTRL+Z) button or F6 button to save the file. After pressing enter key
computer will show a message like 1 file(s) copied. This means that file is stored in the disk. Suppose we don't want
to save the file or we just want to abort from file creation job, then we simply press ^C (CTRL+C) button to abort
without saving the file, intend of pressing ^Z button.
Notes:- 1. Never forget to give a suitable filename
2. You can use extension as .TXT for denoting the file as Text file.
8. TYPE:- This command is used to display the contents or text of any file to the display device.
Syntax:- C:\> TYPE <Filename>
A:\>TYPE GULAB.TXT
A clock in a office can never get stolen
Too many employees watch it all the time
9. COPY :- Copy command is used for copy any file to another location or to copy the files to another directory.
This command may also be used for copying any file to another disk with different file name.
Syntax:- C:\> COPY <Source filename> <Target file name>
C:\>COPY ROSE.TXT ROSE.MSG 1 file(s) copied
TO copy a file from hard disk to floppy disk
C:\>COPY Rose.txt A: 1 file(s) copied
To copy a file from Floppy Disk to Hard disk
A:\>COPY LOTUS.TXT C:\ 1 file(s) copied
10. REN:- (Rename) This command is used to change the name of any file or directory.
Syntax:- C:\> REN <Source filename> <Target filename>
C:\>REN ROSE.TXT GULBAL.TXT
If we get successfully C:\ that means filename or directory name is get changed. Either it will show the error
message.
To changing the filename present in floppy disk
C:\>REN A:\ROSE.TXT GULAB.TXT
Note that you cannot specify a new drive or path for your destination.
11. DEL:- This command is used for erasing any file from the disk.
Syntax:- C:\> DEL <Filename>
C:\>DEL LOTUS.TXT
If it successfully erase the file from dosk then C:\> prompt will be appear, either computer will show an error
message.
Pr 3: Directory related commands
MD:- (Make Directory)- This command allows to create a new directory.
Syntax:- C:\> MD <Dirname>
C:\> MD REPORT
C:\>
Now this directory can be used for keeping various sort of reports. Under this directory we can create another
directory which is known as subdirectory.
CD:- (Change Directory):- We can enter or exit from any directory using this command.
Syntax:- To access any directory
C:\> CD <Directory name>
C:\> CD REPORT
C:\REPORT>
Prompt will change with the directory name. If we keep two dots after CD command than we will exit from the
directory.
Syntax:-C:\> CD..
C:\REPORT> CD..
C:\>
RD:-(Remove directory):- This command is used when we want to remove any unusable directory form our disk.
Syntax:- C:\> RD <Directory name>
C:\> RD REPORT
PATH:- This command is used for display or sets directories for executable files.
Synatx:- C:\> PATH
This command display current path settings.
C:\> PATH=C:\WINDOWS\COMMAND;C:\WINDOWS\;C:\TC
this command will sets the directories windows, the command subfolder of windows and TC folder for executable
files. Operating system will look for executable files in these directories.
Pr 4: Wild card commands
Wild card commands: Wildcard commands are used when we are working with multiple files instant of a single
file at a time. These commands uses '?' and '*' symbol.
The '?' wildcard character
Suppose we want to list out all the files and directories which have primary file name made of four characters and
secondary name made of 3 characters. then here we use DIR command with following switches
C:\> DIR ????.???
Here a '?' symbol represent that ? can be a any character or it may be special symbols.
Suppose we want to list out all the files which primary field name made of 4 characters, the first character start with
'C' and secondary name is 'EXE'. Then we uses
C:\> DIR C???.EXE
The '*' wildcard character
If we want to list all the files with extension .EXE the the command we give is-
C:\> DIR *.EXE
If we want to display all files with first character 'D' and extension 'EXE' in floppy disk, then we give the command
C:\> DIR A: D*.EXE
Some Internal commands with wild card
COPY:-If we have to copy the songs from our CD drive to our Hard disk. Then we suppose E:\ is our CD drive and
we have to store all the songs in C:\ SONGS directory.
C:\> COPY E:\ *.MP3 C:\ SONGS
REN:- If we want to rename all the files which have extension of 'TXT' to extension 'MSG' then we give the
command
C:\> REN *.TXT *.MSG
DEL:- If we want to erase those files which have the extension of 'TMP' from our disk then we uses the command
C:\> DEL *.TMP
If we use /p switch the computer give ask every time before deleting the file. If we enter 'Y' the it will erase the file
from disk either it will leave the file.

Pr 4: External command
External command: An external command is an MS-DOS command that is not included in cmd.exe. External
commands are commonly external either because they require large requirements or are not commonly used
commands.
External commands are known as Disk residence commands. Because they can be store with DOS directory or any
disk which is used for getting these commands. Theses commands help to perform some specific task. These are
stored in a secondary storage device. Some important external commands are given below-
MORE MOVE FIND DOSKEY MEM FC DISKCOPY
FORMAT SYS CHKDSK ATTRIB XCOPY
SORT LABEL
1. MORE:-Using TYPE command we can see the content of any file. But if length of file is greater than 25 lines
then remaining lines will scroll up. To overcome through this problem we uses MORE command. Using this
command we can pause the display after each 25 lines.
Syntax:- C:\> TYPE <File name> | MORE
C:\> TYPE ROSE.TXT | MORE
or
C:\> DIR | MORE
2. MEM:-This command displays free and used amount of memory in the computer.
Syntax:- C:\> MEM
the computer will display the amount of memory.
3. SYS:- This command is used for copy system files to any disk. The disk having system files are known as
Bootable Disk, which are used for booting the computer.
Syntax:- C:\> SYS [Drive name]
C:\> SYS A:
System files transferred
This command will transfer the three main system files COMMAND.COM, IO.SYS, MSDOS.SYS to the floppy
disk.
4. XCOPY:- When we need to copy a directory instant of a file from one location to another the we uses xcopy
command. This command is much faster than copy command.
Syntax:- C:\> XCOPY < Source dirname > <Target dirname>
C:\> XCOPY TC TURBOC
5. MOVE:- Move command is used for moving one file or multiple files from one location to another location or
from one disk to another disk.
Syntax:- C:\> MOVE <file name> <path name>
C:\SONGS> MOVE *.MP3 C:\ SONGS\OLD SONGS\
C:\>
6. FC:-(File Compare) This command is capable for comparing two set of files and display difference between two
files.
Syntax:- C:\> FC <First set of file> <Second set of file>
C:\> FC ROSE.TXT GULAB.TXT
7.CHKDSK:-(Check disk) - This command is used to check the status of a disk and show the report of result status.
Syntax:- C:\> CHKDSK
C:\>CHKDSK
CHKDSK has NOT checked this drive for errors.
You must use SCANDISK to detect and fix errors on this drive.
Volume JAI created 10-19-2001 7:14p
Volume Serial Number is 3E42-1907
4,203,073,536 bytes total disk space
381,988,864 bytes available on disk
4,096 bytes in each allocation unit
1,026,141 total allocation units on disk
93,259 available allocation units on disk
651,264 total bytes memory
610,784 bytes free
Instead of using CHKDSK, try using SCANDISK. SCANDISK can reliably detect
and fix a much wider range of disk problems.
8. SORT:- This command is useful when we want to sort a file. When we run this command the result can be get to
display device or file.
Syntax:- C:\> SORT /R < Input file name> <output file name>
Suppose we have a file Player.txt which having the list of a cricket player team and we want to sort the list of
players, then we uses this command
C:\> SORT Player.txt If we not specify the output file
name then result will show to the screen.
/R- switch is used for sorting the file in descending order like from Z to A or from 9 to 0.
9. FIND:- The FIND command is used to search a file for a text string.
Syntax:- C:\> FIND "String to search" <File name>
C:\TEST>find "office" gulab.txt
---------- gulab.txt
A clock in a office can never get stolen
10. DISKCOPY:- DISKCOPY copies the contents of a floppy disk to another.
Syntax:- C:\> DISKCOPY <Drive1> <Drive2>
C:\> DISKCOPY A: B:
This command will be copy all contents of A drive to B drive.
11. ATTRIB:- Sets the various type of attribute to a file. Like Read only, Archive, Hidden and System attribute.
Syntax:- C:\> ATTRIB [± r] [± a] [± h] [± s] <File name>
here r - for read only, a- for archive, h - for hidden, s - for hidden attribute.
C:\> ATTRIB +r Gulab.txt
This command will change the attribute of file gulab.txt to read only mode. To remove the read only attribute we
will follow this command.
C:\> ATTRIB -r Gulab.txt
12. LABEL:- If you are not happy with the volume label of hard disk, you can change it.
Syntax:- C:\> LABEL
C:\>LABEL
Volume in drive C is JAI
Volume Serial Number is 3E42-1907
Volume label (11 characters, ENTER for none)? INFOWAY
13. DOSKEY:- Once we install doskey , our dos will star to memorize all commands we uses. We can recall those
commands using up or down arrow keys. It also gives the facility to create macros, which creates a short key for
long keyword or command.
Key function for Doskey are given as-
UP,DOWN arrows recall commands
Esc clears current command
F7 displays command history
Alt+F7 clears command history
F9 selects a command by number
Alt+F10 clears macro definitions
Syntax:- C:\> DOSKEY
DOSKey installed
Creating Macros:-
C:\>doskey t=time
C:\>t
C:\>time
Current time is 3:39:05.97p
Enter new time:
To list out all macros defined just type DOSKEY/MACROS at dos prompt and press enter.
C:\>DOSKEY/MACROS
$D=date
T=time
14. FORMAT:- This command creates new Track & Sectors in a disk. Every
Syntax:- C:\> FORMAT [drive name] [/S]
C:\> FORMAT A:
this command will create new track & sectors.
C:\> FORMAT A: /S
This command will transfer system files after formatting the disk.
Pr 1: Introduction to DOS Command
When we start MS-DOS, we get a symbol on the screen like this
C:\>
This symbol is known as C drive or C-prompt. similarly A:\> is called A-prompt or A drive. Generally A:\ is used as
floppy drive i.e. when we are working on floppy disk and C:\ is used for local disk or hard disk. A small blinking bar
we see on the screen. This is cursor. It is waiting for your instruction. There few predefined words for DOS. These
are known as DOS-Commands. Our operating system can understand only these predefined commands.
These DOS-Commands are divided into two parts.
Internal Commands External Commands
A file may be known as container of information on a particular topic. A directory may be considered as a structure
or a cabinet which keeps one or more files.
Directories are usually creates for keeping one or more identical files together. Every file have a filename which
helps to recognize them. these are divided into two parts
File name or Primary name
Extension or Secondary name
The primary name can be from 1 to 8 characters long. The extension contains 1 to 3 characters long. A filename and
extension are separated by using a dot symbol. Thus it's structure looks like

Filename . Extension
Primary name . Secondary Name
The command available are all combined together and are stored in Command.com file, which is a executable
command file. These internal command are further grouped according to their properties. These are as follows.

Genral purpose File related commands Directory related commands

1. CLS
7. COPY CON
2. DIR
8. TYPE 12. MD
3. VER
9. COPY 13. CD
4. VOL
10. REN 14. RD
5. DATE
11. DEL
6. TIME

Pr 2: DOS- General purpose commands


General purpose commands
1. CLS:- (Clear the screen) This command is used to clear the screen or wipe out every thing written on the screen.
Syntax:- C:\> CLS and press Enter
2. DIR:- (Directory) Dir command is used for listing files and directories present in the current disk.
Syntax:- C:\> DIR [/switches]
Example:- C:\> DIR /P
Switches:-
/P Page wise
/W Widths wise
/S List all files and directory of subdirectories
/AH Display directory with hidden files
/AS Display directory with system files
/AD Display only directories present in current drive
3. VER:-(Version) Version numbers indicates that which edition of DOS we are working on.
Syntax:- C:\> VER press enter
Output:-
C:\>VER
Windows 98 [Version 4.10.2222]
4. VOL:-(Volume) Displays the disk volume label and serial number, if it exist.
Syntax:- C:\> VOL press enter
Output:-C:\>VOL
Volume in drive C is ANC
Volume Serial Number is 3E42-1907
5. DATE:- Display the current Date
Syntax:- C:\> DATE
C:\>DATE
Current date is Fri 02-15-2002
Enter new date (mm-dd-yy):
Type DATE without parameters to display the current date setting and
a prompt for a new one. Press ENTER to keep the same date.
Note:- We enter new date in the format of MM-DD-YY.
6. TIME:- Display current time
Syntax:- C:\> TIME
C:\>TIME
Current time is 8:38:47.70a
Enter new time:
Type TIME with no parameters to display the current time setting and a prompt for a new one. Press ENTER to
keep the same time.
Note:- We enter the time in the format of 24 hour clock.
File related commands
7. COPY CON:- This command gives the facility to create a new text file.
Syntax:- C:\> COPY CON <Filename>
C:\>COPY CON Rose.txt
A clock in a office can never get stolen
Too many employees watch it all the time
^Z
1 file(s) copied
After copy con we must specify a suitable file name. Press enter. Start typing the informations of the file. After
gathering the information we press ^Z (CTRL+Z) button or F6 button to save the file. After pressing enter key
computer will show a message like 1 file(s) copied. This means that file is stored in the disk. Suppose we don't want
to save the file or we just want to abort from file creation job, then we simply press ^C (CTRL+C) button to abort
without saving the file, intend of pressing ^Z button.
Notes:- 1. Never forget to give a suitable filename
2. You can use extension as .TXT for denoting the file as Text file.
8. TYPE:- This command is used to display the contents or text of any file to the display device.
Syntax:- C:\> TYPE <Filename>
A:\>TYPE GULAB.TXT
A clock in a office can never get stolen
Too many employees watch it all the time
9. COPY :- Copy command is used for copy any file to another location or to copy the files to another directory.
This command may also be used for copying any file to another disk with different file name.
Syntax:- C:\> COPY <Source filename> <Target file name>
C:\>COPY ROSE.TXT ROSE.MSG 1 file(s) copied
TO copy a file from hard disk to floppy disk
C:\>COPY Rose.txt A: 1 file(s) copied
To copy a file from Floppy Disk to Hard disk
A:\>COPY LOTUS.TXT C:\ 1 file(s) copied
10. REN:- (Rename) This command is used to change the name of any file or directory.
Syntax:- C:\> REN <Source filename> <Target filename>
C:\>REN ROSE.TXT GULBAL.TXT
If we get successfully C:\ that means filename or directory name is get changed. Either it will show the error
message.
To changing the filename present in floppy disk
C:\>REN A:\ROSE.TXT GULAB.TXT
Note that you cannot specify a new drive or path for your destination.
11. DEL:- This command is used for erasing any file from the disk.
Syntax:- C:\> DEL <Filename>
C:\>DEL LOTUS.TXT
If it successfully erase the file from dosk then C:\> prompt will be appear, either computer will show an error
message.
Pr 3: Directory related commands
MD:- (Make Directory)- This command allows to create a new directory.
Syntax:- C:\> MD <Dirname>
C:\> MD REPORT
C:\>
Now this directory can be used for keeping various sort of reports. Under this directory we can create another
directory which is known as subdirectory.
CD:- (Change Directory):- We can enter or exit from any directory using this command.
Syntax:- To access any directory
C:\> CD <Directory name>
C:\> CD REPORT
C:\REPORT>
Prompt will change with the directory name. If we keep two dots after CD command than we will exit from the
directory.
Syntax:-C:\> CD..
C:\REPORT> CD..
C:\>
RD:-(Remove directory):- This command is used when we want to remove any unusable directory form our disk.
Syntax:- C:\> RD <Directory name>
C:\> RD REPORT
PATH:- This command is used for display or sets directories for executable files.
Synatx:- C:\> PATH
This command display current path settings.
C:\> PATH=C:\WINDOWS\COMMAND;C:\WINDOWS\;C:\TC
this command will sets the directories windows, the command subfolder of windows and TC folder for executable
files. Operating system will look for executable files in these directories.
Pr 4: Wild card commands
Wild card commands: Wildcard commands are used when we are working with multiple files instant of a single
file at a time. These commands uses '?' and '*' symbol.
The '?' wildcard character
Suppose we want to list out all the files and directories which have primary file name made of four characters and
secondary name made of 3 characters. then here we use DIR command with following switches
C:\> DIR ????.???
Here a '?' symbol represent that ? can be a any character or it may be special symbols.
Suppose we want to list out all the files which primary field name made of 4 characters, the first character start with
'C' and secondary name is 'EXE'. Then we uses
C:\> DIR C???.EXE
The '*' wildcard character
If we want to list all the files with extension .EXE the the command we give is-
C:\> DIR *.EXE
If we want to display all files with first character 'D' and extension 'EXE' in floppy disk, then we give the command
C:\> DIR A: D*.EXE
Some Internal commands with wild card
COPY:-If we have to copy the songs from our CD drive to our Hard disk. Then we suppose E:\ is our CD drive and
we have to store all the songs in C:\ SONGS directory.
C:\> COPY E:\ *.MP3 C:\ SONGS
REN:- If we want to rename all the files which have extension of 'TXT' to extension 'MSG' then we give the
command
C:\> REN *.TXT *.MSG
DEL:- If we want to erase those files which have the extension of 'TMP' from our disk then we uses the command
C:\> DEL *.TMP
If we use /p switch the computer give ask every time before deleting the file. If we enter 'Y' the it will erase the file
from disk either it will leave the file.

Pr 4: External command
External command: An external command is an MS-DOS command that is not included in cmd.exe. External
commands are commonly external either because they require large requirements or are not commonly used
commands.
External commands are known as Disk residence commands. Because they can be store with DOS directory or any
disk which is used for getting these commands. Theses commands help to perform some specific task. These are
stored in a secondary storage device. Some important external commands are given below-
MORE MOVE FIND DOSKEY MEM FC DISKCOPY
FORMAT SYS CHKDSK ATTRIB XCOPY
SORT LABEL
1. MORE:-Using TYPE command we can see the content of any file. But if length of file is greater than 25 lines
then remaining lines will scroll up. To overcome through this problem we uses MORE command. Using this
command we can pause the display after each 25 lines.
Syntax:- C:\> TYPE <File name> | MORE
C:\> TYPE ROSE.TXT | MORE
or
C:\> DIR | MORE
2. MEM:-This command displays free and used amount of memory in the computer.
Syntax:- C:\> MEM
the computer will display the amount of memory.
3. SYS:- This command is used for copy system files to any disk. The disk having system files are known as
Bootable Disk, which are used for booting the computer.
Syntax:- C:\> SYS [Drive name]
C:\> SYS A:
System files transferred
This command will transfer the three main system files COMMAND.COM, IO.SYS, MSDOS.SYS to the floppy
disk.
4. XCOPY:- When we need to copy a directory instant of a file from one location to another the we uses xcopy
command. This command is much faster than copy command.
Syntax:- C:\> XCOPY < Source dirname > <Target dirname>
C:\> XCOPY TC TURBOC
5. MOVE:- Move command is used for moving one file or multiple files from one location to another location or
from one disk to another disk.
Syntax:- C:\> MOVE <file name> <path name>
C:\SONGS> MOVE *.MP3 C:\ SONGS\OLD SONGS\
C:\>
6. FC:-(File Compare) This command is capable for comparing two set of files and display difference between two
files.
Syntax:- C:\> FC <First set of file> <Second set of file>
C:\> FC ROSE.TXT GULAB.TXT
7.CHKDSK:-(Check disk) - This command is used to check the status of a disk and show the report of result status.
Syntax:- C:\> CHKDSK
C:\>CHKDSK
CHKDSK has NOT checked this drive for errors.
You must use SCANDISK to detect and fix errors on this drive.
Volume JAI created 10-19-2001 7:14p
Volume Serial Number is 3E42-1907
4,203,073,536 bytes total disk space
381,988,864 bytes available on disk
4,096 bytes in each allocation unit
1,026,141 total allocation units on disk
93,259 available allocation units on disk
651,264 total bytes memory
610,784 bytes free
Instead of using CHKDSK, try using SCANDISK. SCANDISK can reliably detect
and fix a much wider range of disk problems.
8. SORT:- This command is useful when we want to sort a file. When we run this command the result can be get to
display device or file.
Syntax:- C:\> SORT /R < Input file name> <output file name>
Suppose we have a file Player.txt which having the list of a cricket player team and we want to sort the list of
players, then we uses this command
C:\> SORT Player.txt If we not specify the output file
name then result will show to the screen.
/R- switch is used for sorting the file in descending order like from Z to A or from 9 to 0.
9. FIND:- The FIND command is used to search a file for a text string.
Syntax:- C:\> FIND "String to search" <File name>
C:\TEST>find "office" gulab.txt
---------- gulab.txt
A clock in a office can never get stolen
10. DISKCOPY:- DISKCOPY copies the contents of a floppy disk to another.
Syntax:- C:\> DISKCOPY <Drive1> <Drive2>
C:\> DISKCOPY A: B:
This command will be copy all contents of A drive to B drive.
11. ATTRIB:- Sets the various type of attribute to a file. Like Read only, Archive, Hidden and System attribute.
Syntax:- C:\> ATTRIB [± r] [± a] [± h] [± s] <File name>
here r - for read only, a- for archive, h - for hidden, s - for hidden attribute.
C:\> ATTRIB +r Gulab.txt
This command will change the attribute of file gulab.txt to read only mode. To remove the read only attribute we
will follow this command.
C:\> ATTRIB -r Gulab.txt
12. LABEL:- If you are not happy with the volume label of hard disk, you can change it.
Syntax:- C:\> LABEL
C:\>LABEL
Volume in drive C is JAI
Volume Serial Number is 3E42-1907
Volume label (11 characters, ENTER for none)? INFOWAY
13. DOSKEY:- Once we install doskey , our dos will star to memorize all commands we uses. We can recall those
commands using up or down arrow keys. It also gives the facility to create macros, which creates a short key for
long keyword or command.
Key function for Doskey are given as-
UP,DOWN arrows recall commands
Esc clears current command
F7 displays command history
Alt+F7 clears command history
F9 selects a command by number
Alt+F10 clears macro definitions
Syntax:- C:\> DOSKEY
DOSKey installed
Creating Macros:-
C:\>doskey t=time
C:\>t
C:\>time
Current time is 3:39:05.97p
Enter new time:
To list out all macros defined just type DOSKEY/MACROS at dos prompt and press enter.
C:\>DOSKEY/MACROS
$D=date
T=time
14. FORMAT:- This command creates new Track & Sectors in a disk. Every
Syntax:- C:\> FORMAT [drive name] [/S]
C:\> FORMAT A:
this command will create new track & sectors.
C:\> FORMAT A: /S
This command will transfer system files after formatting the disk.
PR 1: OPEN, CLOSE, CREATE and Modify A DATABASE
1. TO OPEN A DATABASE:
Syntax: use <dbname> Ex: use book
2.TO CLOSE THE DATABASE:
Use
To close the current opened database.
Close all
To close the all opened database.
3. To CREATE NEW DATABASE:
Syntax:
crea <dbname> create <dbname> Ex:
crea book

4. To Modify Structure of the Database:


Modify structure
(Or)
Modi stru

PR 2: Add new records in database


Append is used to add the new record.
Syntax:
append
[Blank]
[From <dbname>]
Ex
Append
Append Blank
- To add blank records.
Append from first.dbf
- To add the records from FIRST.DBF to SECOND.DBF
- Same Structure is required for these databases

PR3: Display Command


Used to display the particular record.
Syntax:
Display
[All]
[Structure]
[Status]
[Memory]
Ex:
Display
Display All
Display All Records in page wise.
To Display the structure of the database:
Display Structure
To display the status of the set commands:
Display Status
To display the status of the system memory variables.
Display Memory

PR4: Edit, Delete records


EDIT
- It list all the records one by one for editing.
Any one of the record can be edited using 'FOR' as below
EDIT FOR empname = "LEELA"
EDIT FOR rollno = 103
To delete records
DELETE
- To delete current record
DELETE NEXT 4
- To delete next 4 records
After using the delete command the records marked with * (asterisk) mark, i.e., marked
for deletion.
RECALL
- It is used to recover the deleted records.
e.g. RECALL
RECALL NEXT 4
PACK
- To delete the records permanently. It is used after the delete command.
BLANK
- It can be used to empty the record instead of deleting.

PR5:Navigation with Records


GO or GOTO both do the same things in Foxpro.
GO TOP
Used to move the record pointer at the first record.
GO BOTTOM:
Used to move the record point at the last record.
Go
To go to a particular record
Syn:- GO <recordno>
Eg:- GO 8
Go to record 8
SKIP
- To skip number of records
e.g. To skip 3 records - SKIP 3
PR6:Handling date and date format
To display current system date
?DATE()
To set century on to display year in 4 digits.
SET CENTURY ON
SET CENTURY OFF
To set date format
dd/mm/yyyy => SET DATE BRIT
mm/dd/yyy => SET DATE AMERICA
yyyy/mm/dd => SET DATE JAPAN

PR7:Replace command
To replace the content of the specified field in the database table. i.e., This command can be used
to remove the data in the particular field (nullifying / empty a field)
e.g.
REPLACE fieldname WITH ""
- To replace with null value
REPLACE fieldname WITH { / / }
- To replace the date field with null value
REPLACE ALL QUANTITY WITH 0
- Replaces the data in the quatity fied with 0 in all the records.
REPLACE ALL PRICE WITH PRICE+50
- Adds 50 to the price field.

You might also like