Programming

Preview:

DESCRIPTION

Introduction to Computer Programming

Citation preview

PROGRAMMING INTRODUCTION

MS DOS COMMAND

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.

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.

WHAT WILL YOU LEARN?

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

HOW TO OPEN COMMAND PROMPT IN

WINDOWS 7 AND WINDOWS 8

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.

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.

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.

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. 

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).

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.

HOW TO CUSTOMIZE THE

COMMAND PROMPT

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.

• 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.

ACCESS THE PROPERTIES OF THE COMMAND

PROMPT

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

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

CUSTOMIZE THE COMMAND PROMPT

CURSOR SIZE, BUFFERS AND EDIT

MODES

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

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. 

'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.

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.

ADJUST THE FONT IN THE COMAMND

PROMPT

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.

CHANGE THE COMMAND

PROMPT WINDOW SIZE

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;

• '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.

HOW TO SET THE COMMAND

PROMPT WINDOWS

• 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.

HOW TO USE THE BASIC COMAMNDS

IN COMMAND PROMPT

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.

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.

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'.

HOW TO ACCESS A CERTAIN DRIVE

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.

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.

HOW TO VIEW THE CONTENT OF A FOLDER

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

HOW TO CREATE A FOLDER USING THE COMMAND

PROMPT

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.

HOW TO RENAME FILES AND FOLDERS

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

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

For folders just type ren foldername newname.

ren 7tutorials_v1 7tutorials_final 

COPY FILES AND FOLDERS

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.

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

DELETE FILES AND WORDS

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.

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

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

LAUNCH AN APPLICATION

FROM COMAMND

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. 

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.

HOW TO USE HELP IN

COMMAND PROMPT

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.

REPAIR MISSING OR CORRUPT

FILES

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

FIX MISSING OR CORRUPT FILES

WHEN THE COMPUTER WON’T

BOOT

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.

FIX MISSING OR CORRUPTED FILES

Recommended