Home > Articles > CompTIA > A+

Using the Command Prompt

The Command Prompt in Windows is a useful command-line interpreter which not only allows for specific usage in the Windows environment but also can be configured to your needs. In this article, David Prowse explains Microsoft’s command-line interpreter and offers tips on configuration and use.
Like this article? We recommend

The Command Prompt is Microsoft’s version of a command-line interpreter or CLI. Some people refer to it as DOS because of its similarity to the DOS command-line. However, the Command Prompt is a Windows entity. The beauty of the Command Prompt is that you can navigate to and configure just about anything in text. Just about anything than can be done in Windows can be done in the Command Prompt.

This article shows how to open the Command Prompt, configure it to your liking, and then explains some of the basics of how to use it.

How to open the Command Prompt

The Command Prompt can be opened in a variety of ways, which will depend on the version of Windows you are using. For example, in Windows 7, you would click Start > All Programs > Accessories > Command Prompt. Another way to access it would be to click Start > Run, then type cmd.exe. Depending on your version of Windows, the Run prompt might not show up in your Start menu, but you can easily access it by pressing the Windows + R keys together. If you need to run the Command Prompt as an Administrator, click Start > All Programs > Accessories, and right-click Command Prompt and select Run as Administrator.

Of course these are only a few of the ways you could open the program; do whatever is fastest for you!

Once you have the Command Prompt open, it will look something similar to Figure 1:

Figure 1 Example of Windows 7 Command Prompt

In Windows 7, by default, this places you in the C:\Users\%username% folder. %username% is whatever user you are logged in as. If you ran the Command Prompt as an administrator, the path you are placed in would be C:\Windows\system32. You can also tell the difference by looking at the title bar of the Command Prompt. If you are running the Command Prompt as an administrator, it will say “Administrator: Command Prompt” in the title bar.

Configuring the Command Prompt to your liking

The initial look of the Command Prompt may be a bit hard on the eyes. With its standard black background and small text, you might wish to modify it. Let’s make it a white background with black text, and increase the size of the text a bit.

In this step-by-step, we will use the Windows 7 Command Prompt.

  1. Open the Command Prompt.
  2. Right-click the title bar and select Properties. This displays the Command Prompt Properties dialog box.
  3. Click the Font tab, and select 12X16 in the Size area. This should noticeably change the size of the text which you can see in the “Selected Font: Terminal” area.
  4. Click the Colors tab, and select the white color box to change the screen background.
  5. Next, click Screen Text, and select the black color box to change the screen text. This should give you a white background with black lettering, as shown in the “Selected Screen Colors” area. An example of this is shown in Figure 2. Of course, feel free to select whatever colors you like[md]even the old school Commodore 64 blue on blue!

Figure 2 Example of a Modified Windows 7 Command Prompt

You can also change the size of the window in the layout tab, as well as how much history will be remembered by the Command Prompt. Use these options to configure a Command Prompt that displays what you want in a pleasing fashion.

Using the Command Prompt

Now let’s talk some of the basics when it comes to using the Command Prompt. I’ll delve into three areas: navigation of the operating system, how to ping another computer on the network, and the creation of batch files.

Navigation

Navigating the operating system is done with the CD command. You can go anywhere in the directory tree with this command. (By the way, “directories” and “folders” are synonymous.)

For example, in Figure 2 I am currently located in the C:\Users\Lamprocles path. (Lamprocles is one of my silly usernames.) If you wanted to go to the root of C in one fell swoop, you could easily do this by typing CD \, as shown in Figure 3.

Figure 3 Use of the CD \ Command

To return to the folder we were at before, we could type CD \users\lamprocles. It works in this manner regardless of what folder you want to access. Any folder in any path can be accessed in this way; just be sure to remember the root \ in the beginning of each path. To see commands that you typed previously, press the Up arrow on the keyboard. You will be able to scroll back and forth through the commands you used, and it makes for a nice timesaver.

Pinging

To find out if another computer on the network is “alive” or available to you for communication, you can use the ping command. Ping reaches out to the remote computer and returns results based on whether it finds the computer. For example, if your computer had the IP address of 192.168.1.1 and a second computer on the network had the IP address 192.168.1.2, you could verify the existence of that second computer on the network by typing ping 192.168.1.2. After pressing Enter, you should receive replies. If you do not, the computer is not available on the network, or your computer is not accessing the network properly. You could also use this command to ping your router, other computers on the network, even websites. Try pinging my personal website with the following command: ping davidlprowse.com.

Batch Files

Batch files are files that contain one or more commands. These files can be executed to produce one or more results without having to open the Command Prompt. For example, let’s say you wanted to ping another computer every day but didn’t want to go through the hassle of opening the Command Prompt, typing the command, and waiting for the answers. You could create a batch file that would automate the process. To do so you would open a new file in Notepad (this can be opened by accessing the Run prompt and typing notepad), and create the batch file by typing ping 192.168.1.2 for example. Then you would select File > Save As. Next, Click the Save as type drop-down menu and select All Files. Then name the file (for example, ping.bat). Note the .bat extension. Save the file to your desktop or wherever you like.

Afterwards, to run the file, you double-click it. In Windows 7 and Vista you would need to right-click it and select Run as administrator in order for it to work properly. This automatically opens the Command Prompt (our modified version with new colors and font size), starts the ping, and awaits replies from the host, 4 in total. Plus, you can do this with just about any command, or groups of commands. Also, the batch file can output the results to text files or to printers. Automation saves you time, and batch files can be very instrumental when it comes to automation. In 32-bit Windows versions, you can even create the batch files from within the Command Prompt by using the edit command. However, this is not available by default in 64-bit versions, and would have to be added to an existing Windows 64-bit installation.

vceplus-200-125    | boson-200-125    | training-cissp    | actualtests-cissp    | techexams-cissp    | gratisexams-300-075    | pearsonitcertification-210-260    | examsboost-210-260    | examsforall-210-260    | dumps4free-210-260    | reddit-210-260    | cisexams-352-001    | itexamfox-352-001    | passguaranteed-352-001    | passeasily-352-001    | freeccnastudyguide-200-120    | gocertify-200-120    | passcerty-200-120    | certifyguide-70-980    | dumpscollection-70-980    | examcollection-70-534    | cbtnuggets-210-065    | examfiles-400-051    | passitdump-400-051    | pearsonitcertification-70-462    | anderseide-70-347    | thomas-70-533    | research-1V0-605    | topix-102-400    | certdepot-EX200    | pearsonit-640-916    | itproguru-70-533    | reddit-100-105    | channel9-70-346    | anderseide-70-346    | theiia-IIA-CIA-PART3    | certificationHP-hp0-s41    | pearsonitcertification-640-916    | anderMicrosoft-70-534    | cathMicrosoft-70-462    | examcollection-cca-500    | techexams-gcih    | mslearn-70-346    | measureup-70-486    | pass4sure-hp0-s41    | iiba-640-916    | itsecurity-sscp    | cbtnuggets-300-320    | blogged-70-486    | pass4sure-IIA-CIA-PART1    | cbtnuggets-100-101    | developerhandbook-70-486    | lpicisco-101    | mylearn-1V0-605    | tomsitpro-cism    | gnosis-101    | channel9Mic-70-534    | ipass-IIA-CIA-PART1    | forcerts-70-417    | tests-sy0-401    | ipasstheciaexam-IIA-CIA-PART3    | mostcisco-300-135    | buildazure-70-533    | cloudera-cca-500    | pdf4cert-2v0-621    | f5cisco-101    | gocertify-1z0-062    | quora-640-916    | micrcosoft-70-480    | brain2pass-70-417    | examcompass-sy0-401    | global-EX200    | iassc-ICGB    | vceplus-300-115    | quizlet-810-403    | cbtnuggets-70-697    | educationOracle-1Z0-434    | channel9-70-534    | officialcerts-400-051    | examsboost-IIA-CIA-PART1    | networktut-300-135    | teststarter-300-206    | pluralsight-70-486    | coding-70-486    | freeccna-100-101    | digitaltut-300-101    | iiba-CBAP    | virtuallymikebrown-640-916    | isaca-cism    | whizlabs-pmp    | techexams-70-980    | ciscopress-300-115    | techtarget-cism    | pearsonitcertification-300-070    | testking-2v0-621    | isacaNew-cism    | simplilearn-pmi-rmp    | simplilearn-pmp    | educationOracle-1z0-809    | education-1z0-809    | teachertube-1Z0-434    | villanovau-CBAP    | quora-300-206    | certifyguide-300-208    | cbtnuggets-100-105    | flydumps-70-417    | gratisexams-1V0-605    | ituonline-1z0-062    | techexams-cas-002    | simplilearn-70-534    | pluralsight-70-697    | theiia-IIA-CIA-PART1    | itexamtips-400-051    | pearsonitcertification-EX200    | pluralsight-70-480    | learn-hp0-s42    | giac-gpen    | mindhub-102-400    | coursesmsu-CBAP    | examsforall-2v0-621    | developerhandbook-70-487    | root-EX200    | coderanch-1z0-809    | getfreedumps-1z0-062    | comptia-cas-002    | quora-1z0-809    | boson-300-135    | killtest-2v0-621    | learncia-IIA-CIA-PART3    | computer-gcih    | universitycloudera-cca-500    | itexamrun-70-410    | certificationHPv2-hp0-s41    | certskills-100-105    | skipitnow-70-417    | gocertify-sy0-401    | prep4sure-70-417    | simplilearn-cisa    |
http://www.pmsas.pr.gov.br/wp-content/    | http://www.pmsas.pr.gov.br/wp-content/    |