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
- Starting and Configuring Console Sessions
- Using the Console
- Useful Network Commands
Launch a Console Session
This section explain how to start a Windows Console if shortcuts or other aids have not been set up.
- From the Start menu, Select Run...
- In the text box, type:
- command for Windows 95/98/ME
- cmd for Windows NT/2000/XP/Vista/Windows 7
Create a Console Shortcut
- Right-click on any free space on your Desktop.
- Select New then Shortcut.
- When the Create Shortcut Wizard appears, type:
- command for Windows 95/98/ME
- cmd for Windows NT/2000/XP/Vista/Windows 7
- Click Finish.
- 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:
dir > dirlist.txt
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:
more < dirlist.txt
This will feed the file contents of
dirlist.txtto themorefor execution.Pipes
One can also direct the output of one program to another using "pipes". For example:
dir | more
This will feed the output of the
dirprogram to themoreprogram. Themoreprogram 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:
dir *.txt
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.
winword.exe myFile.doc
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.
start myFile.doc
This command will run the application which is associated with
*.docfile extensions. This has the advantage that you do not need to know the name or the location of the application which is associated with*.docfiles.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 = 0msTracert
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:
netstat -h
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 ESTABLISHEDRoute
Route has many options which you can see with:
route -h
It is used to display and manipulate the Windows Routing Table:
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