79
PROGRAMMING INTRODUCTION MS DOS COMMAND

Programming

Embed Size (px)

DESCRIPTION

Introduction to Computer Programming

Citation preview

Page 1: Programming

PROGRAMMING INTRODUCTION

MS DOS COMMAND

Page 2: Programming

What is DOS?

Short for Microsoft Disk Operating System, MS-DOS is a non-graphical command line operating system derived from 86-DOS that was created for IBM compatible computers. MS-DOS originally written by Tim Paterson and introduced by Microsoft in August 1981and was last updated in 1994  when MS-DOS 6.22 was released.

Page 3: Programming

Today, MS-DOS is no longer used; however, the command shell, more commonly known as the Windows command line is still used by many users. In the picture to the right, is an example of what a MS-DOS window more appropriately referred to as the Windows command line looks like under Microsoft Windows.

Page 4: Programming

WHAT WILL YOU LEARN?

Page 5: Programming

1. How to Hide or Dismount a Partition in Windows

2. An Ode to the Command Prompt - the Most Powerful and Least Used Windows Tool

3. Fix Issues with your Boot Records

4. Repair Missing or Corrupt Files

5. Advanced Commands for System Information & Managing Active Tasks

6. Advanced Disk Management Commands

7. Advance Networking Commands

8. How to use Basic Commands9. How to Customize the Command Prompt

Page 6: Programming

HOW TO OPEN COMMAND PROMPT IN

WINDOWS 7 AND WINDOWS 8

Page 7: Programming

1. Launch the Command Prompt Using Search.Search is very helpful, both in Windows 7 and Windows 8. In Windows 7, open the Start Menu and type command or cmd.

Then, click the Command Prompt search result.

Page 8: Programming

2. Launch it from the Run WindowOne of the quickest ways to launch the Command Prompt is to use the Run window (press Win+Ron your keyboard to open it).Then, type cmd or cmd.exe and press Enter or click/tap OK.

Page 9: Programming

3. Launch it from the Start Menu/ScreenIf you like clicking on stuff and you are using Windows 7, open the Start Menu. Then, go to All Programs -> Accessories.

There you will find the Command Prompt shortcut.

Page 10: Programming

4. Create a Command Prompt Shortcut on the Desktop If you prefer using your own shortcuts, then don’t hesitate to create a shortcut to the Command Prompt. 

Page 11: Programming

5. Pin it to the Start Menu/Screen or the TaskbarIf you would rather have a clean Desktop, you might want to pin the Command Prompt to the taskbar, the Start Menu (in Windows 7) or to the Start screen (in Windows 8).

Page 12: Programming

6. Launch it from Windows/File ExplorerLast but not least, you can open Windows Explorer (in Windows 7) or File Explorer (in Windows 8). Then, open the partition where Windows is installed and browse to Windows -> System32.

Page 13: Programming
Page 14: Programming

HOW TO CUSTOMIZE THE

COMMAND PROMPT

Page 15: Programming
Page 16: Programming

WHAT IS COMMAND PROMPT?

Before Windows came into the picture, the most common operating system was DOS (Disk Operating System). It was a text-based operating system, that enabled you to run programs by manually typing in commands. The launch of the Windows operating system simplified the whole computing experience by making it more visual. Even though DOS has not been included in Windows operating systems for years, there still is the Command Prompt - the text command-line interpreter, analog of the command shell of its old DOS ancestor.

Page 17: Programming

• This tool is generally used by more advanced users such as system administrators to run commands which might not be triggered from the visual interface of Windows.

• Even though it may look a bit unfriendly, it does not mean that you cannot learn how to use it. If you will follow our mini-series you will see that this tool is useful and can be used by anyone.

Page 18: Programming

ACCESS THE PROPERTIES OF THE COMMAND

PROMPT

Page 19: Programming

To access the properties of the Command Prompt and customize them, right click on its window and select Properties.

Page 20: Programming

You will notice four tabs with options that can be configured: Options, Font, Layout and Colors.

Page 21: Programming

CUSTOMIZE THE COMMAND PROMPT

CURSOR SIZE, BUFFERS AND EDIT

MODES

Page 22: Programming

First, you have the Options tab. It has three sections: Cursor Size, Command History and Edit Options.

Page 23: Programming

For the cursor you can choose its size by using one of the available options: Small, Medium or Large.

Command History area you can customize how many commands are retained in the buffer. 

The buffer serves as a historical record of the commands you have run and you can use the up and down arrow keys to navigate through the previously entered commands. 

Page 24: Programming

'Number of Buffers' determines for how many concurrent instances of the Command Prompt you’re having separate buffers created. 

'Discard Old Duplicates', allows Windows to remove duplicate command entries from the buffer.

Edit Options area you have only two options: Quick Edit Mode and Insert Mode.

Page 25: Programming

A sample of how Quick Edit Mode works can be viewed in the capture below. With the mouse, I selected the text for copying. I pressed Enter and the text was copied to the clipboard.

Page 26: Programming

ADJUST THE FONT IN THE COMAMND

PROMPT

Page 27: Programming

In the Font tab you will be able to select the Font size and Font Type. Also, you can use the preview window to see the effect of your settings before applying them.

Page 28: Programming

CHANGE THE COMMAND

PROMPT WINDOW SIZE

Page 29: Programming

The Layout tab has three simple sections where you can configure the size of the Command Prompt window and of the lines of text within it.

The available options are as follows:• 'Screen Buffer Size' - allows you to configure

the number of characters that are displayed on a line in the Command Prompt window. This is achieved by adjusting the Width value, and the number of lines that are stored in memory, by adjusting the Height value;

Page 30: Programming

• 'Window Size' - allows you to select the Width and Height of the window.

• 'Window Position' - enables you to configure the Command Prompt's window distance from the left and top edges of the screen. This option works only if the 'Let System Position Window' check box is not checked.

• 'Let System Position Window' - if it's checked, you won’t be able to configure the window position settings.

Page 31: Programming
Page 32: Programming

HOW TO SET THE COMMAND

PROMPT WINDOWS

Page 33: Programming

• The Colors tab is easy to configure. There are four items that can be customized:

• Screen Text - allows you to set the color of the text displayed in the Command Prompt window;

• Screen Background - enables you to choose the background color of the Command Prompt window;

• Popup Text - allows you to set the color of the text displayed in a pop-up window;

• Popup Background - permits you to set the background color of a pop-up window.

Page 34: Programming
Page 35: Programming
Page 36: Programming

HOW TO USE THE BASIC COMAMNDS

IN COMMAND PROMPT

Page 37: Programming

HOW TO NAVIGATE BETWEEN FOLDERS

The first command from the list is CD (Change Directory). This command enables you to change the current directory (or folder).

The command CD\ takes you to the top of the directory tree.

Page 38: Programming
Page 39: Programming

Now you are working on the 'C:' drive. If you need to go to a specific folder from this drive just type CD DIRECTORYNAME. The subdirectory names are separated by \.

For example when you need to access the System32 folder that is located on 'C:\Windows' just type cd windows\system32\, and then press Enter.

Page 40: Programming
Page 41: Programming

When you need to go to one folder up, use the cd.. command. Let's assume that you want to go back to the Windows folder. Type cd.. and press Enter. You will notice that your current directory has changed to 'C:\Windows'.

Page 42: Programming

HOW TO ACCESS A CERTAIN DRIVE

Page 43: Programming

To access another drive just type the drive letter followed by ':'. For example, we wanted to change the drive from 'C:' to 'D:'. We have typed d: and then pressed Enter.

Page 44: Programming

To change the drive and the directory at the same time, use the cd command followed by the /dswitch. The parameter is used to change the current drive to a specific folder from other partition. For example, now you are on the 'D:' drive and you want to go back to the 'C:' drive directly to the Windows folder. Type cd/d C:\Windows and press Enter, as you can see in the following image.

Page 45: Programming
Page 46: Programming

HOW TO VIEW THE CONTENT OF A FOLDER

Page 47: Programming

You can view the content of a folder by using a simple command called DIR.

Page 48: Programming
Page 49: Programming

HOW TO CREATE A FOLDER USING THE COMMAND

PROMPT

Page 50: Programming

You can make a new directory using the MKDIR (Make Directory) command. The syntax of this command is MKDIR directory name.

Let's say we need to create a new folder called 7tutorials_v1 that will be placed in the'd:\7tutorials' folder. We will type mkdir 7tutorials_v1 and then we press Enter.

Page 51: Programming
Page 52: Programming

HOW TO RENAME FILES AND FOLDERS

Page 53: Programming

To test if it worked, we will use again the dir command. The newly created folder appears in the list.

Page 54: Programming

To rename files and folders you need to use the REN (Rename) command.

For folders just type ren foldername newname.

Page 55: Programming

ren 7tutorials_v1 7tutorials_final 

Page 56: Programming
Page 57: Programming

COPY FILES AND FOLDERS

Page 58: Programming

The Copy command allows you to copy files from one location to another. To use this command you have to type 

copy location\filename.extension location\newname.extension.

Page 59: Programming
Page 60: Programming

To copy a folder and its content from a location to another we will use the XCOPY command followed by the /s / i operators.

Page 61: Programming

DELETE FILES AND WORDS

Page 62: Programming

The DEL (Delete) is used to delete files within the directories you've created.

To delete all the files from a directory you have to type del directory name.

Page 63: Programming

If we need to delete a single file we will use the DEL command followed by the filename.

Page 64: Programming
Page 65: Programming

The DEL command cannot be used to delete directories, therefore we will use another command to remove any empty directory: RD (Remove Directory). 

Page 66: Programming

LAUNCH AN APPLICATION

FROM COMAMND

Page 67: Programming

To run a program from the Command Prompt, you need only to navigate to the directory that contains the executable and simply type in the program name. 

Page 68: Programming

For example, if we want to launch Paint using Command Line, we have to go to C:\Windows\System32 and there we will find the executable called mspaint.exe. Let's see how this operation can be done, if we are on D:\7tutorials. First off all we have to change the working directory to the application's folder by typing cd/d c:\windows\System32\. Then we just write mspaint.exe and press Enter. Both commands can be seen in the capture below.

Page 69: Programming
Page 70: Programming

HOW TO USE HELP IN

COMMAND PROMPT

Page 71: Programming

To access help in Command Prompt you just have to type the help command and then press Enter. A list off all available commands will be displayed.

Page 72: Programming
Page 73: Programming

REPAIR MISSING OR CORRUPT

FILES

Page 74: Programming

NOTE: When a corrupt or missing system file prevents the operating system from booting normally, you need to use the Windows 7 setup DVD or a System Repair Disc to start the Command Prompt and, from there the System File Checker (SFC). If Windows 7 boots, but you get messages about missing system files, you will be able to fix the problem by running the System File Checker (SFC) in the Command Prompt

Page 75: Programming

FIX MISSING OR CORRUPT FILES

WHEN THE COMPUTER WON’T

BOOT

Page 76: Programming

In the Command Prompt window, use the sfc command with two additional parameters:/offbootdir and /offwindir.

The parameter /offbootdir is used to specify the boot partition - the partition that contains the boot files needed for booting Windows 7. The /offwindir parameter is designed to specify the location of the Windows 7 directory.

Page 77: Programming
Page 78: Programming

FIX MISSING OR CORRUPTED FILES

Page 79: Programming