General DOS Commands
DIR (Listing)
Lists files or directories in your current directory.
start > run > cmd >
what we call character? and * characters are used.
Dir *.exe with the extension EXE
Dir a*.exe with the bat letter a and the extension EXE
Dir a*.e* with the bat letter Files with a and initial letter e
Dir a?b*.exe and EXE files with bat letter a and third letter b
Dir *. Files with no extension can be listed
.
The basic rule here is that * instead of all letters, ? is a substitute for a single letter.
You can also search in DOS with the dir command.. If the /s parameter is given, DOS also lists files in subdirectories..
For example,
Dir important.doc /s can be used to search for a file named important.doc.
FOLDER OPERATIONS(CD, MD,RD)
Use
CD FOLDER NAME to enter a folder.
For example, to enter the Windows directory
C:>CD Windows
C:WINDOWS>
To enter the WindowsSystem directory
C:>CD Windows
Used as
C:WINDOWS>CD System
C:WINDOWSSYSTEM>
.
CD to exit a folder..
C:WINDOWSSYSTEM>CD..
C:WINDOWS>
To return to the main folder CD
C:WINDOWSSYSTEM>CD
C:>
To create a new directory
MD FOLDER NAME
For example, to create a folder named REPORTS
MD REPORTS
To delete a folder
RD folder name
To delete a new REPORTS folder
Used as RD REPORTS
.
To be able to delete a folder with this method, it must be empty.
REPLACING DRIVER
In the DOS operating system, each drive is represented by a letter. Letters A, and B are used for floppy drives, others for
hard disks and other drives. You can
switch to that drive by using “:” after drive letters.
A: to floppy drive,
C: to hard disk.
Commands applied after switching to a driver take effect on that driver.
For example, you can type
C:>A:
A:>Dir
to see the contents of a floppy disk.. Or in short
C:> DIR A:
SYSTEM TRANSFER (SYS COMMAND)
Sys a: to floppy
Sys c: to harddisk system transfer done.
LABEL (Change floppy label)
LABEL You can use C: command. You will be asked for an 11 letter label.
LABEL A: command is used to change the label of the floppy disk.
The name of this program is LABEL.EXE
DATE, TIME (Change Date and Time)
C:>date
Current date Sun 05 /01/1999
Enter new date (dd-mm-yy):_
C:>date
Current date Sun 03/01/1999
Enter new date (dd-mm-yy ):_
COPY OPERATIONS (COPY, XCOPY, DISKCOPY)
Copy Source Destination
, mostly used with two parameters. The first determines where to copy, the second
to copy.
Copy school.doc a:
Copies the file named school.doc in the active directory to the floppy disk.
Copy a:okul.doc c:
Copies the file named school.doc from the floppy disk to the hard disk.
Copy school.doc list.doc
Copies the file named school.doc to the same location with the name list.doc.
Copy a:school.doc
Copies the file named school.doc on the floppy disk to the place where the command is written.
Copy *.* a:
Copies all files in the current directory to floppy disk.
Copy a:*.* c:
Copies all files from floppy disk to hard disk.
Copy Autoexec.bat con
Copies the Autoexec.bat file to the screen. (Con is the name used for the screen. To copy to the screen means to
show the inside.)
Copy *.bat con
Copies all files with the bat extension to the screen.
Copy Con new.txt
Here source is screen and destination is a file. So we want it to copy the screen to the new.txt file. This
state is a special case for the copy command and is used to write to a file.. After typing this command
, all the letters you type until you press the F6 key will be written in the new.txt file..
Copy document.txt prn
This line will send the document.txt file to the printer. (The word prn is used for printer. Depending on the port your printer is connected to, you can also use LPT1, LPT2, COM1, COM2.) You can press the Print Screen button to send the image on the screen to the printer.. With the
Copy command, you can also perform an error test when copying a file.. Especially when copying
to floppy disk, it is good to have this test.. Use the /V parameter to perform a bug test.
Copy Okul.doc a: / v We want
School.doc to copy the file to the floppy disk by performing an error test. While this process is copying the file to the
floppy, it also reads what it wrote and checks whether it is read correctly or not.. If there are bad sectors on the floppy disk, it will not be able to read what is written and will give an error.. Cancel the operation and use a solid floppy disk, or format the floppy disk if there is no important information in it and copy it again after ensuring that the bad parts are
marked.
While copying, if there is a file with the same name in the copied location, it will be asked whether to overwrite it or not.. The
XCOPY command is also used to copy. Unlike the copy command it is faster and can copy with subdirectories. Although the copy command is an internal command, the Xcopy command is an external
command and the file XCOPY.EXE must exist.. The use of the
Xcopy command is similar to the copy command.. Alternatively, it is possible to copy subdirectories with the /S parameter..
Xcopy a:*.* /s c:
Copies all the files on the floppy disk together with the subdirectories to the c: drive. The advantage of Xcopy is that it can copy
faster and copy with subdirectories. The
DISKCOPY command is different.. Used to copy a floppy disk to another floppy disk.. Floppy disks replicated with
Diskcopy are exactly the same. With the
Diskcopy a: a:
command, the floppy disk in drive a can be duplicated.. During this process, first the original floppy disk is read, then the other floppy disk is requested to be inserted and written to this floppy disk.. If the reading process is not finished in one go,
the first floppy is requested again and the remaining part is read and written to the other floppy disk.. In
Diskcopy operation, all files in the target floppy disk are deleted by the computer before copying..
The name of this program is DISKCOPY.COM.
you can speed up transactions.
NAME CHANGE (REN)
You can rename files with Ren command. Used as
Ren Filename Newname
. For example, to change the name of the required.doc file to unnecessary.doc,
Ren Required.doc is written as unnecessary.doc
. When changing the name, if there is a file with the same name as the new name, the replacement is not done..
MOVE OPERATION (MOVE)
The name of this program is MOVE.EXE. Used to move files from one place to another directory or drive and to rename
directories.
For example
Move c:public*.* to move all files from Public directory to Private directory
Move c:pw*.* to move all files from private
PW directory to floppy disk Changing the directory name with the
Move command is like changing the file name with Ren. For example, to change the PW directory to
WRITE, use
Move PW WRITE.
TYPE (FILE CONTENT) Used to see the contents of a file in
DOS. Used as
Type Filename
. For example, to see the contents of the autoexec.bat file,
Type is written as autoexec.bat
. EDIT command should be used to make changes on the file..
MORE(PAGE)
If the results of some DOS commands do not fit on the screen, the result of the command is displayed page by page. We can provide it by using together with the character.
For example; You can view the contents of the autoexec.bat file with the
Type autoexec.bat
command.. However, if the file is too long to fit on the screen, the upper lines in the file will not be visible on the screen.. We can use this together with the More command..
Type autoexec.bat | If used as More
, when the content of the file fills the screen, you will be prompted to press a key and the next page will be displayed after that.
More command is not alone, it is behind other commands | used with the character.
EDIT(FILE CREATION AND EDITING) You can use Edit program to edit and create files in
DOS.. With this program, you can open your files and make changes.. The name of this program is EDIT.COM.
Edit Autoexec.bat
You can make changes to the autoexec.bat file by typing.
ATTRIB (FILE PROPERTIES)
A file is read only, cannot be deleted by normal means if it is set as system or hidden file.
If you do not want some files to be easily deleted, or if there are
files that you want to delete but cannot delete, you should change the properties of that file with the Attrib command.. The name of this file is
ATTRIB.EXE.
Attrib filename used as properties
. As you can give a file as the filename ? You can also
change the properties of multiple files using the characters and *. The properties of the files are changed with the third parameter
. If the third parameter is not given, only the properties are displayed, no action is taken..
To remove a feature, you should use the following parameters with – sign, and to give that feature, you should use the + sign
.
R Read-only file. They cannot be changed or deleted by normal means..
H Hidden file. They cannot be deleted by normal means and are not listed when the Dir command is used without parameters..
S System file. This is a feature only for some special files. Deleting, modifying or moving files with this feature will cause problems.. These files are
invisible and cannot be deleted by normal means..
For example, to give EVRAK.DOC read-only feature
Attrib EVRAK.DOC +R to hide
Cokgizli.doc
Attrib cokgizli +h to hide
Cokgizli.doc and make it read-only For
Attrib veryhidden +h +r
You can also hide not only files but also directories
Attrib Windows +h
Command will hide windows directory. If you type dir, you cannot see this directory..
CHKDSK(DISK TEST)
This program (CHKDSK.EXE) gives statistical
information about the drive if used without any parameters. (Like free space, total space, number of files)
C:>chkdsk
Volume Serial Number 0B26-13D9
1,048,395.776 bytes total disk space
25,182,208 bytes in 231 hidden files
9,601,024 bytes in 575 directories
884,178,944 bytes in 9,956 user files
16,384 bytes in bad sectors
129,417.216 bytes available on disk
16,384 bytes in each allocation unit
63,989 total allocation units on disk on
7,899 allocation units available on disk
655,360 bytes total memory
578,240 bytes free
Chkdsk/F Detects and fixes errors on disk. Used to quickly test the disk (floppy or hard disk). More detailed
Chkdsk /V Lists all files on the disk with their pathname to the screen. There is no point in listing thousands of files on the screen.. However, if it is requested to write to a file instead of listing it on the screen, this file can be examined more easily
Özgür ŞENERDOĞAN