<< Back

How To Use a Windows Console

Overview

This document describes how to use a Windows Console. The Windows Console provides a command-line interface to the Windows Operating System. It is available on Windows 95, 98, ME, NT, 2000 and XP. While the Windows Desktop is the standard GUI interface to the Windows Operating System, the Console provides direct access to the File System and allows ALL types of programs to executed.

On This Page

Launch a Console Session

This section explain how to start a Windows Console if shortcuts or other aids have not been set up.

  1. From the Start menu, Select Run...
  2. In the text box, type:

Create a Console Shortcut

  1. Right-click on any free space on your Desktop.
  2. Select New then Shortcut.
  3. When the Create Shortcut Wizard appears, type:
  4. Click Finish.
  5. Rename the shortcut to: Windows Console

From now on, you can open a Windows Console by simply clicking that shortcut.

Try experimenting with the Properties of the Console. Right-click on the shortcut, select Properties and look at the many options that let you customize the size of the Console, its Icon, its Working Directory, etc.

Redirection

One useful feature of a console window is output redirection. For example, if you want to print a list of all the files in a particular directory, type the following command:

This writes everything to the text file "dirlist.txt" instead of the screen. You can examine it at your leisure, print it out, and even send it an email message. Also, you can send it to another program, if that program is designed to receive Standard Input. For example:

This will feed the file contents of dirlist.txt to the more for execution.

Pipes

One can also direct the output of one program to another using "pipes". For example:

This will feed the output of the dir program to the more program. The more program is a standard filter program which "knows" how many lines of text the Console can display. It prompts the user for input and waits for the user to press the Enter key before showing the next screen of information.

Wildcards

There are two useful wildcard characters:

Wildcard Description
? Matches an single character
* Matches any number of characters

For example, one might enter:

This would display any file with an extension of "txt".

Starting an Application

You can start any program you like from the Console. As long as Windows knows where to find that program, it will load it and execute it.

This will start the Windows Word application in a separate Window, and the file myFile.doc will be opened for editing.

But there is an even easier way of doing the same thing.

This command will run the application which is associated with *.doc file extensions. This has the advantage that you do not need to know the name or the location of the application which is associated with *.doc files.

Ping

Ping is used to test whether of not a networked machine is reachable:

C:\>ping www.cabrillo.cc.ca.us

Pinging rocky.cabrillo.cc.ca.us [172.16.1.1] with ...

Reply from 172.16.1.1: bytes=32 time=1ms TTL=255
Reply from 172.16.1.1: bytes=32 time<10ms TTL=255
Reply from 172.16.1.1: bytes=32 time<10ms TTL=255
Reply from 172.16.1.1: bytes=32 time<10ms TTL=255

Ping statistics for 172.16.1.1:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum =  1ms, Average =  0ms

Tracert

Tracert is the Windows equivalent of the UNIX traceroute program. It is used to display a list of gateways through which a packet passes while travelling to its final destination:

C:\>tracert yahoo.com

Tracing route to yahoo.com [216.115.108.243]
over a maximum of 30 hops:

  1     1 ms   <10 ms     1 ms  rocky.cabrillo.cc.ca.us ...
  2     1 ms     2 ms     2 ms  seahawk.cabrillo.cc.ca.u...
...
 12    21 ms    21 ms    21 ms  bbr02-p3-0.snva02.exodus...
 13    20 ms    21 ms    20 ms  dcr01-g9-1.snva02.exodus...
 14   128 ms   212 ms   215 ms  64.15.161.130
 15     8 ms     9 ms     9 ms  yahoo.com [216.115.108.2..

Netstat

Netstat has many options which you can see with:

Among other things, it is used to list the TCP and UDP ports in use on your system:

C:\>netstat -n

Active Connections

  Proto  Local Address          Foreign Address        State
  TCP    127.0.0.1:80           127.0.0.1:1107         ESTABLISHED
  TCP    127.0.0.1:80           127.0.0.1:1108         ESTABLISHED
  TCP    127.0.0.1:1107         127.0.0.1:80           ESTABLISHED
  TCP    127.0.0.1:1108         127.0.0.1:80           ESTABLISHED
  TCP    172.16.10.211:1026     172.16.1.44:524        ESTABLISHED
  TCP    172.16.10.211:1033     172.16.1.44:524        ESTABLISHED

Route

Route is used to display and manipulate rounting tables in Unix-like and Windows systems. It has many options which you can see with:

As an example:

C:\>route print

Active Routes:

Network Address         Netmask Gateway Address     Interface Metric
        0.0.0.0         0.0.0.0      172.16.1.1 172.16.10.211      1
      127.0.0.0       255.0.0.0       127.0.0.1     127.0.0.1      1
     172.16.0.0   255.255.224.0   172.16.10.211 172.16.10.211      1
  172.16.10.211 255.255.255.255       127.0.0.1     127.0.0.1      1
 172.16.255.255 255.255.255.255   172.16.10.211 172.16.10.211      1
      224.0.0.0       224.0.0.0   172.16.10.211 172.16.10.211      1
255.255.255.255 255.255.255.255   172.16.10.211 172.16.10.211      1

<< Back