Command Prompt

  • May 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Command Prompt as PDF for free.

More details

  • Words: 1,137
  • Pages: 5
Windows Command Prompt Exercise 64



Click on Prompt.

.

Select All Programs, Accessories, then click on the Command

When you open Command Prompt, it will list the version of Windows you are using. It will then display the pathname of the directory that you are currently in. Your pathname might be different from the example shown.

A flashing cursor displays after the path name. This is called the command prompt and it is here that you enter the DOS commands. Simply type the command you wish to use and press the Enter key to perform the action. It is important to note that when you enter commands into DOS you can potentially change settings from within Windows, delete important files, etc. Be careful that you do not cause unintentional damage.

Note

Writing in DOS To be able to use DOS (or any command line system), you need to be able to write in a code which the computer can understand. DOS has a series of commands which you can enter to perform different tasks. Some of the commonly used commands are described below. Note

DOS commands are not case sensitive. It is just convention which sees them typed in capital letters.

DIR - Directory This command lists all the files and folders contained within the current directory. Exercise 65



Type DIR and press Enter.

© Software Educational Resources Ltd

SECTION 4

77

CD - Change directory The CD command is used to change from your current directory (folder) to another directory. The following diagram shows a file structure containing a series of folders and subfolders. EXAMPLE

ESSAYS

TESTS

TEST1

TEST2

You would start in the parent directory (the EXAMPLE directory). To move down the hierarchy, you would type in the CD command followed by a space and the name of the directory you want to go to. To change to the ESSAYS directory, type in:

CD ESSAYS Change command

Directory you want to change to

These commands are always followed by the Enter key. To go up one level type the CD command followed by a space and then two full stops. The command below returns you to the EXAMPLE directory.

It is possible to go down more than one level in the same command. Use a back slash between the folder and subfolder name. The command below takes you directly from the EXAMPLE folder to the TEST1 directory:

CD TESTS\TEST1 A \ is placed between the TEST folder and the TEST1 subfolder

78

SECTION 4

© Software Educational Resources Ltd

To go up two levels, use the CD command followed by three full stops.

CD ... You can also use the command CD to display the pathname of the directory that you are currently in. If you are unsure what the current directory is, type CD and press Enter to display it. Note

If you want to change drives (e.g. from the C: drive to the A: drive) you do not use the CD command. Type in the letter of the drive you wish to change to followed by a colon. E.g. to change to the floppy drive type: A: and press Enter.

DATE The DATE command will display the current date. Exercise 66

1

Type CLS and press Enter to clear your screen.

2

Type DATE and press Enter. DOS will then ask you whether you want to enter a new date. Do not type in a new date. Note

3

Changing the system date can cause problems with some programs and should be done with caution.

Press Enter again to accept the current date without changing it.

HELP Typing Help displays a list of DOS commands and an explanation of what they are for. Exercise 67



Type HELP and press Enter.

© Software Educational Resources Ltd

SECTION 4

79

File Management The hierarchy of files and folders shown below will be used to illustrate some of the commands that follow. You will be given an opportunity to practice these in the exercises that follow. C: C:

EXERCISE

ASMNTS

ASMNT1.txt

ASMNT2.txt

WKSHEETS

SHEET1.xlsx

SHEET2.xlsx

NOTES

CODE.docx

THEORY.txt

A Note on file extensions When working with file names in DOS you need to include the file extension, e.g. you have to type SHEET1.xlsx rather than just SHEET1.

DOSKEY Type DOSKEY at the command prompt to load the DOSKEY program. After DOSKEY has been loaded, you can use the arrow keys to repeat the last command used.

DEL – Delete The DEL command is used to delete files and folders. You must be in the parent directory OR you must type the full path name to the file. For example, if you wanted to delete the document ASMNT2 from the hierarchy shown above you could use the Change Directory command to go to the ASMENTS folder and type: DEL ASMNT2 OR from the C: drive you could type:

DEL EXERCISE\ASMENTS\ASMNT2.TXT Note

Whereas when you delete a file using Windows, you are generally asked whether you are sure you want to delete it, when using DOS you will not be asked. Therefore you must be sure you want to delete the file before using the DEL command.

EDIT The EDIT command takes you to the Editor and allows you to change the contents of text files with a character editor. To edit the file named ASMNT1.txt, type the following command:

EDIT ASMNT1.txt

80

SECTION 4

© Software Educational Resources Ltd

The command prompt will change to edit mode and the text within the text file will display.

The mouse can be used when in edit mode to access menus and to click within the text. It is also possible to use arrow keys to move around the text. Position the flashing cursor within the text you wish to edit and use the Backspace and Delete keys to remove text. New text can then be typed. When you have finished editing, select [File] Exit or press Alt F then X. The Save File message box will display.

Click on Yes or press Y to save changes to the file. The Command Prompt will return to normal command mode.

COPY The COPY command is used to create a duplicate of a file. This file can be created within the same directory as the original or it can be copied to another folder. To create a copy of a file, ensure the current directory contains the file (e.g. if you want to copy the THEORY file you must be in the NOTES folder). Type COPY then the name of the file (including the file extension) followed by the name of the copy.

COPY THEORY.txt THEORY1.txt Original file

Name of duplicate file

This will copy the THEORY text file and create a duplicate in the same folder with the name THEORY1.

© Software Educational Resources Ltd

SECTION 4

81

Related Documents