You are on page 1of 19

DOS Commands

WMSU
What is the difference between the two user
interface?

This Photo by Unknown Author is licensed under CC BY-SA-NC


This Photo by Unknown Author is licensed under CC BY-SA

1981 2021
Command Shell
• Command Shell
– software program that provides direct communication between the user and the operating
system.
– Non-graphical user interface
– The command shell in the Windows Server operating system uses the command
interpreter, Cmd.exe.

• Cmd.exe
– loads applications
– directs the flow of information between applications,
– and translates user input into a form that the operating system understands.
DOS Commands
• DOS Commands
– are instructions to perform tasks on files and directories.
– commands can be typed in either uppercase or lowercase

• Directory
– files where we store group of information or data, and collection of group of files
– “Folder”

• Path
– A string that defines the location of a certain object (file).
DOS Commands
• MS-DOS file names format
– e.g. ReadMe.txt
– to name a file or a directory, special characters (< > , . / * ? | etc..) are not allowed.
DOS Command
DOS commands are divided into 2 types:
1. Internal Commands
Perform basic operations on files and directories
Do not need any external file support

2. External Commands
Perform advanced tasks and need some external file support as they are not
stored in the COMMAND.COM

COMMAND.COM is a command-line interpreter in MS-DOS (Microsoft Disk Operating System),


Windows 95-98, Windows 98SE, and Windows ME. In DOS, it is the default user interface. Its
successor is the cmd.exe
Internal Commands
C:\>date
-Display the system’s current date setting and prompts you to enter a
new date.

C:\>date /t
- Display the system’s current date setting without prompting for a new
date

C:\>date 05-05-19
C:\>date 05.05.2019
C:\>date 5/5/19
- To change the current system date to new date, use any of the
format. (administrative credentials only)
Internal Commands
C:\>time
- Displays or sets the system time. If used without parameters, time
displays the current system time and prompts you to enter a new time.

C:\>time /t
-Displays the current system time.

C:\>time 17:30:00
C:\>time 5:30 PM
-To change the current system time to new time.
Internal Commands
C:\>copy con filename.extension
The purpose of this command is to create a file. File extension is
optional, by default the file type is FILE.
e.g. copy con hello.txt

C:\>copy hello.txt C:\Users\PC\Folder


-Copy hello.txt in the current drive to destination path. If the
destination directory does not exist e.g. Folder, hello.txt is copied
into a file named Folder that is located in the directory one level
down.

C:\>copy hello.txt C:\Users\PC\Folder\helloworld.txt


Internal Command
C:\>ren oldfilename newfilename
-Rename the old file name with new file name
e.g. ren hello.TXT helloworld.TXT
Internal Command
C:/>dir
- This command displays a list of files and subdirectories in a
directory.
C:>dir ..
-shows list of files and subdirectories one level down.
C:>dir c:\users\pc\documents
-shows list of files and subdirectories of the given directory.
Internal Command
C:\>del hello.txt
-Delete the file in the current directory.

C:\>del c:\users\pc\documents\helloworld.txt
-delete the file helloworld.txt with the specified path.
Internal Command
C:\>cd directory
- Change from one directory or sub-directory
e.g.
C:\Users\PC>cd Documents
C:\Users\PC\Documents>

-executing cd Documents, which is a sub-directory found in PC, changed


the current directory.

C:\>cd ..
-Moves the directory one level down.
External Command
C:\>CHKDSK
-returns the configuration status of the selected disk. It returns the
information about the volume, serial number, total disk space, space
in directories, space in each allocation unit, total memory and free
memory.

Membership in the local Administrators group, or equivalent, is the minimum required to


run chkdsk.
External Command
C:\>diskcopy sourcepath destinationpath
e.g. c:/> diskcopy A: B:
-Diskcopy works only with removable disks such as floppy disks, which
must be the same type. You cannot use diskcopy with a hard disk.
External Command
C:/>format drivename
e.g. C:/>format A:
- Format is used to erase information off of a computer diskette or
fixed drive.
External Command
C:/>move sourcepath destinationpath
-move file/from one directory to another.
e.g.
C:\Users\PC>move hello.txt c:\users\pc\desktop
-assuming hello.txt is located in path c:\users\pc\, its new
destination will be at c:\users\pc\desktop
-you cannot move multiple files at once. You can move all files that
are of a specific file type.
e.g. C:\Users\PC> move *.txt c:\users\pc\documents

How to specify the directories/files which have white spaces in the


names?
-You need to enclose the name of the file/directory in double quotes.
External Command
C:\>sfc /scannow
-system file checker; checks integrity of all protected system files.
External Command
Remove/Delete Virus in a Disk
C:\>E:
E:\>attrib –s –h –r /s /d *.*

s = system
h = hidden
r = read-only
d = include any process folder

- = means cancel the specified attribute


/s = Applies attrib and any command-line options to matching files in
the current directory and all of its subdirectories.
/d = Applies attrib and any command-line options to directories.
*.* = wildcard (* = all files with any file type)

You might also like