'; window.popUpWin.document.write(zhtm); window.popUpWin.document.close(); // Johnny Jackson 4/28/98 } //--> Windows 98 Professional Reference -- Appendix C -- Command-Line Reference


Windows 98 Professional Reference

Previous chapterNext chapterContents


- C -
Command-Line Reference


This appendix is structured in the following manner:

Command-Line Structure

The command-line structure of Windows 98 is the same as MS-DOS and Windows 95 commands. An executable file ends in the extension .EXE, .COM, or .BAT. The typical command structure is as follows:

C:\command.exe parameter /switch

Example:

C:\copy.exe C:\myfile.txt A:\ /V

In this example, the command is FORMAT.EXE with a parameter of C: and a switch of /s. This command tells Windows 98 to format the C: drive and place the system files on it after the format is complete. This command structure is consistent throughout Windows 98. Some commands may not have switches or parameters, but those that do use this structure.


NOTE: Depending on the command, the dash (-) may be substituted for the front slash (/) before a switch.


Internal Commands

Several basic Windows 98 commands are loaded into memory at all times. These commands are actually part of the file COMMAND.COM that defines the command-line environment. In fact, when you run a command prompt in Windows 98, you are actually executing the file COMMAND.COM. These commands are called internal commands because they do not exist on the disk. In contrast, external commands are actually executable files on the hard drive. The following list shows all the internal commands included with Windows 98.

BREAK

Activates extended CTRL+C checking

CD (CHDIR)

Changes the active directory

CHCP

Changes the current Code Page number

CLS

Clears the screen

COPY

Copies files from one location to another

CTTY

Changes the control terminal of the system

DATE

Modifies the system date

DEL (ERASE)

Deletes unwanted files from a disk

DIR

Displays a list of files in the current directory

EXIT

Exits the current command prompt

LH

Loads a program into upper memory

MD (MKDIR)

Creates a directory on a disk

PATH

Sets the PATH system environment variable

PROMPT

Sets the command prompt

RD (RMDIR)

Removes an empty directory from a disk

REN (RENAME)

Renames a file on a disk

SET

Sets and displays environment variable

TIME

Sets and displays the system time

TYPE

Displays the contents of ASCII files

VER

Displays the current version of Windows on the system

VERIFY

Sets an environment variable that instructs Windows 98 to verify that files are written correctly

VOL

Displays the volume label and serial number for a specified disk

System Commands

You can use system commands to display and modify the environment settings of the system. The following system commands are included with Windows 98.

ACCWIZ

C:\Windows\System\ACCWIZ.EXE

This command starts the Windows Accessibility Settings Wizard. This wizard allows you to change the various accessibility settings that are available in the Accessibility icon under the Control Panel. This application gives you the same control as the Accessibility properties page but in a wizard format.

DEBUG

C:\Windows\Command\DEBUG.EXE

Debug is an interactive program to test and edit any type of file on the system. To load a program into debug, type the following command:

DEBUG filename

Debug loads the file and displays a Debug prompt. The Debug prompt is a dash (-). To display the commands you can use in Debug, type ? and press Enter. Debug displays the contents of the file in hexadecimal and allows you to change the values. Debug is intended for programmers with a knowledge of Assembler and hexadecimal. Debug is a complicated tool that this book does not cover in detail.


WARNING: Debug enables you to modify any file on your disk, including Windows system files. Do not make any modifications using Debug unless you are absolutely sure you know what you are doing. You can easily destroy your system files beyond repair using this utility.


DOSKEY

C:\Windows\Command\DOSKEY.COM

DOSKEY is a program that enables you to create a command buffer in memory. This buffer holds the last several commands that you typed. You can recall these commands by pressing the up-arrow key on the keyboard. You can scroll forward in the list of commands with the down-arrow key. This command is handy when you need to type the same several commands repeatedly.

DOSKEY Parameters and Switches

EDIT

C:\Windows\Command\EDIT.COM

Edit is a simple text editor that can be used at the command prompt. It is nearly identical to the editor included with Windows 95 and previous versions of MS-DOS. You can use EDIT to create and modify any ASCII file.

EDIT Parameters and Switches

KEYB

C:\Windows\Command\KEYB.COM

The KEYB command configures your keyboard for a specific language. To use a keyboard definition file to remap your keyboard, type the following command:

C;\KEYB filename

The filename parameter is the name of the keyboard map file. This file instructs Windows 98 to load the custom keyboard map into memory. KEYB is a handy way to customize functional keys for a specific application.

KEYB Parameters and Switches

MEM

C:\Windows\Command\MEM.EXE

The MEM command displays the amount of memory in your system. It breaks the output into conventional, upper, reserved, extended, total, and free memory.

MEM Parameters and Switches

MODE

C:\Windows\Command\MODE.COM

This command configures system-level devices such as COM and LPT ports. The command syntax depends on the task you are trying to complete. You can use this command to set baud and parity rates for your COM ports, for example. This command is rarely used, as these settings can be made from the GUI.

MORE

C:\Windows\Command\MORE.COM

MORE is a program that Displays output from other commands one page at a time. This command is usually piped onto another command. For example, you can use the following command to force the TYPE command to display a large file one page at a time:

C:\TYPE longfile.txt | MORE

This command prevents the text from scrolling to the end. The MORE command is handy when another command does not contain a switch that pauses output after each screen is displayed. If MORE is used as the primary command, it will display the contents of the file as if you used the TYPE command. The following command produces the same syntax as the preceding command:

C:\MORE longfile.txt

NLSFUNC

C:\Windows\Command\NLSFUNC.EXE

The NLSFUNC command loads country-specific information into the system. You usually use this command with other country-specific commands, such as KEYB, to convert your system for use in a specific country. This command requires a file containing the country-specific information. The following command loads the information from the spain.nfo file:

C;\NLSFUNC spain.nfo

PROGMAN

C:\Windows\PROGMAN.EXE

PROGMAN launches the classic Windows Program Manager. Although the Explorer interface included with Windows 95 and Windows 98 provides more functionality and ease of use, some people prefer the classic Program Manager interface from Windows 3.1. Running PROGMAN launches this interface.

REGEDIT

C:\Winodws\REGEDIT.EXE

This command launches the Windows 98 Registry Editor. You can use the Registry Editor to modify system settings; its use is covered extensively in other sections of this book. It is important to mention here, as it is not displayed as an icon by default in the Windows GUI.


WARNING: It is possible to cripple your system by making the wrong changes in Registry Editor. Be sure you understand the ramifications of your changes before you make them.


SETVER

C:\Windows\SETVER.EXE

This command sets the version number that Windows 98 reports to a program. This information is important when running certain applications that run only under a previous version of Windows. The following command sets the reported version of WIN.COM to 3.11:

C:\SETVER WIN.COM 3.11

Now when an application requests the version number for this file, it receives 3.11 instead of 4.1. This setting fools the application into thinking it is running under Windows for Workgroups.

SETVER Parameters and Switches

START

C:\Windows\Command\START.EXE

You can use this command to run a Windows or DOS program. The reason you would use this command rather than just typing the filename of the program is that it enables you to specify how the program initially runs. To run the GO.BAT file in the background you would use the following command:

C:\START /m GO.BAT

START Parameters and Switches

WINFILE

C:\Windows\WINFILE.EXE

This command starts the classic Windows File Manager. This program was replaced by Windows Explorer in Windows 95, but some users prefer to use the File Manager from Windows 3.1. This command was included to give you both options.

WINVER

C:\Windows\WINVER.EXE

This command displays the version of Windows currently running on the system.

Disk and File Commands

Disk and file commands enable you to manipulate files on your system. This section covers the disk and file commands included with Windows 98.

ATTRIB

C:\Windows\Command\ATTRIB.EXE

This command changes file attributes from the command line. Each file on the system contains an attribute that Windows 98 uses to protect important files. The attributes are as follows:

To change the attributes of your files with the ATTRIB command, you would use the following syntax:

ATTRIB [+R | -R] [+A | -A] [+S | -S] [+H | -H] filename

The plus- and minus-sign parameters add or remove the specified attribute. For example, to add the hidden and read-only attributes to a file called testdata.dat, use the following command:

C:\ATTRIB +H +R testdata.dat

You can verify that the attributes have been changed by using the following command:

C:\ATTRIB testdata.day

Using the ATTRIB command with just the filename displays the list of attributes associated with that file.

If you want to change the attribute for all files in a specified path, you can use the /s switch with the command.

C;\ATTRIB +r C:\DATA /s

This command adds the read-only attribute to all files in the C:\DATA directory.

CHKDSK

C:\Windows\Command\CHKDSK.EXE

The CHKDSK command runs a quick check of your disk drive and displays a report showing the allocation of space on the disk. CHKDSK can fix minor problems on a disk such as file fragmentation. The following command checks a disk and repairs any errors:

C:\CHKDSK C: /F

CHKDSK Parameters and Switches

DELTREE

C:\Windows\Command\DELTREE.EXE

The DELTREE command deletes every file in a specified directory and then deletes the folder. This utility is useful for removing unwanted file structures from your drive. For example, to remove a directory called olddata that contains multiple subdirectories use the following command:

C:\DELTREE D:\olddata

WARNING: This command-line utility deletes the specified directory structure without using the Recycle Bin. Be very careful when using this command.


DELTREE Parameters and Switches

DISKCOPY

C:\Windows\Command\DISKCOPY.COM

This command copies the contents of one disk to another and offers an easy way to duplicate floppy disks. The disadvantage of DISKCOPY is that both disks must be the same type. Because DISKCOPY copies files by tracks, both types of media must have the same number of tracks. For example, you cannot use DISKCOPY to copy the contents of a 5.25" floppy to a 3.5" floppy. To copy the contents of one disk to another using only one disk drive, use the following syntax:

C:\DISKCOPY a: a:

DISKCOPY Parameters and Switches

EXTRACT

C:\Windows\Command\EXTRACT.EXE

The EXTRACT command extracts individual files from the cabinet files in which Microsoft stores files on distribution media. CAB files can be found on almost every CD or disk that Microsoft distributes. The syntax of the EXTRACT command is as follows:

C:\EXTRACT cabfile.cab desiredfile.xxx

EXTRACT Parameters and Switches

FC

C:\Windows\Command\FC.EXE

The FC command compares two files and shows the differences between them. To compare the files file1.dat and file2.dat, use the following command:

C:\FC file1.dat file2.dat

FC Parameters and Switches

FDISK

C:\Windows\Command\FDISK.EXE

The FDISK utility creates and deletes partitions on a hard drive. To view partition information from the command line, use the following command:

C:\FDISK /STATUS

FIND

C:\Windows\Command\FIND.EXE

The FIND command locates a text string in a specified file. For example, to find the word service in the file dept.dat, use the following command:

C:\FIND "service" dept.dat

FIND Parameters and Switches

FORMAT

C:\Windows\Command\FORMAT.COM

The format command is used to format a disk. For example, to format a floppy disk in the A: drive, use the following command:

C:\FORMAT A:

FORMAT Parameters and Switches

LABEL

C:\Windows\Command\LABEL.EXE

The label command enables you to add a volume label to a disk. To add the label HDD1 to your C: drive, use the following command:

C:\LABEL C: HDD1

To view the label on your disk, type LABEL or DIR.

MOVE

C:\Windows\Command\MOVE.EXE

The MOVE command moves files from one location to another. It accomplishes this job by copying the file to the new location and then deleting the old file. The effect is similar to dragging a file to a new location in Windows Explorer while holding down the Shift key. To move the file exam.dat from C:\data to C:\archive, use the following command:

C:\MOVE C:\data\exam.dat C:\archive\exam.dat

If you want to rename the file to exam.arc while you move it, modify the command as follows:

C:\MOVE C:\data\exam.dat C:\archive\exam.arc

You can also use the MOVE command to rename a directory without actually moving anything. To rename the data directory to examdata without altering any of the files contained in it, use the following command:

C:\MOVE C:\data C:\examdata

SORT

C:\Windows\Command\SORT.EXE

The SORT command sorts input and displays the results. For example, to sort the names in the file names.txt and write them to the file sortname.txt, use the following command:

C:\SORT names.txt sortname.txt

You can also pipe other commands through the SORT command to sort the output of the primary command. For example, you can type the contents of the autoexec.bat file and display each line in alphabetical order with this command:

C:\TYPE autoexec.bat | SORT

SORT Parameters and Switches

SUBST

C:\Windows\Command\SUBST.EXE

The SUBST command associates a path with a drive letter. For example, the following command associates the path C:\WINDOWS\SYSTEM with the drive letter F.

C:\SUBST F: C:\WINDOWS\SYSTEM

This command enables you to quickly access your system directory without having to type the path repeatedly. Windows 98 also displays a new drive in My Computer and Windows Explorer that corresponds to the specified path. The drive mapping remains in effect until the system is rebooted or until you use the following command to remove the association:

C:\SUBST F: /D

XCOPY

C:\Windows\Command\XCOPY.EXE

The XCOPY command copies files and directories from one disk to another. This command is similar to the DISKCOPY command except that XCOPY does not require both disks to be of the same type. Therefore, you can use XCOPY to copy files from a 2 GB hard drive to a 6 GB hard drive. The reason is that XCOPY does a bit-for-bit transfer rather than copying by tracks. To copy the contents of C: drive to D: drive, use the following command:

C:\XCOPY C: D:

XCOPY Parameters and Switches

Network Commands

Network commands display and modify network settings. This section covers the command-line network commands included with Windows 98.

ARP

C:\Windows\ARP.EXE

The ARP command enables you to display and modify the ARP tables used by Address Resolution Protocol to resolve IP addresses to MAC addresses. To display the current ARP tables, type the following command:

C:\ARP -a

To add a static entry to the ARP table that associates IP address 172.221.138.14 to MAC address 00-aa-0b-21-c4-02, you would type the following command:

C:\ARP -s 172.221.138.14 00-aa-0b-21-c4-02

Putting this entry in your ARP table effectively ties an IP address to a specific NIC card. Whenever your machine tries to communicate with 172.221.138.14, it will tie the specified MAC address into the packet header. You can delete this static ARP table entry with the following command:

C:\ARP -d 172.221.138.14

ARP Parameters and Switches


NOTE: Notice that the switches for this command use the dash (-) instead of the front slash (/).


FTP

C:\Windows\FTP.EXE

The FTP command starts the command-line File Transfer Protocol utility. This program is used to transfer files with an FTP server. To connect with the FTP server ftp.microsoft.com, type the following command:

C:\FTP ftp.microsoft.com

You will be prompted for a username and password. After entering this information, you are returned to the FTP prompt. Several commands in the FTP program enable you to navigate through an FTP server. For example, to change to the public directory and download a file called filelist.txt on an FTP server, type the following command:

FTP> cd public
FTP> get filelist.txt

NOTE: Most FTP servers are case sensitive. The reason is that most FTP servers are running on UNIX systems and UNIX differentiates between case. If a filename is Filelist.TXT, you must type the name exactly, including case. Typing GET FILELIST.TXT results in a File Not Found error.


FTP Command Reference

IPCONFIG

C:\Windows\IPCONFIG.EXE

The IPCONFIG command displays a listing of the IP configuration. To display this information, type the following command:

C:\IPCONFIG

If you are using DHCP, you can use the IPCONFIG command to release and renew your IP address.

IPCONFIG Parameters and Switches


NOTE: The n in the last two switches refers to the LANA number of the card. You can see these numbers by running the IPCONFIG command with no switches.


NBTSTAT

C:\Windows\NBTSTAT.EXE

You can use the NBTSTAT command to view current IP connections that are using NetBIOS over TCP/IP. To view the remote machine name table for a machine with an IP address of 169.254.36.201, use the following command:

C:\NBTSTAT -A 169.254.36.201

NBTSTAT Parameters and Switches


NOTE: Notice that the switches for this command use the dash (-) instead of the front slash (/) and that they are case sensitive.


NET

C:\Windows\NET.EXE

The NET command displays and manages NetBIOS connections to other machines. For example, you can view any network drive mappings with the following command:

C:\NET USE

The NET command is broken into sections depending on the first parameter in the command. The following commands are available using the NET command.

NET CONFIG

The NET CONFIG command displays your current computer name, workgroup name, username, and software versions.

NET DIAG

The NET DIAG command enables you to test the connection between two machines on a network. When you run NET DIAG on the first machine, it becomes a network diagnostics server. Subsequent machines connect to this server when they run NET DIAG.

NET HELP

The NET HELP command provides detailed help on each NET command. You can also use NET HELP to decipher an error number that you receive from a NET command.

NET INIT

The NET INIT command initializes the network. NET INIT loads the NIC drivers and the protocols, but doesn't bind them to the Protocol Manager. This command is rarely used anymore as most networking will be handled by protected mode drivers in Windows 98.

NET LOGOFF

This command removes the network bindings from your NIC, which breaks all network connections. This command prevents any network traffic from reaching your system.

NET LOGON

This command enables you to connect to other machines by identifying you as a member of a workgroup. This command is rarely used, as you are given the option to log on when you start Windows 98.

NET PASSWORD

This command changes your network password, that is, the password stored in the username.PWL file on your system. Changing your password affects all subsequent logons including logon from the GUI at system startup.

NET PRINT

This command enables you to view the printer queues on any network printers you have configured. This command is also rarely used, as it is much easier to use the Printers window in the GUI to view print jobs.

NET START

The NET START command enables you to start network services. The downside is that you cannot start network services from a command prompt. To use this command, you need to run Windows 98 in MS-DOS mode. This command enables you to connect to the network in a fully DOS-compatible environment.

NET STOP

This command stops all network services. Like the NET START command, you cannot stop network services from a command prompt. This command is of value only if you are running in MS-DOS mode.

NET TIME

The NET TIME command synchronizes your system clock with another machine on this network. To synchronize your clock with a computer named TIMESERVER, use the following command:

C:\NET TIME \\TIMESERVER

NET USE

The NET USE command maps local drives to network shares. To view a listing of drive mappings on your system, type the NET USE command with no parameters. To map your M: drive to the Public share on a computer named HAL9000 from the command prompt, use the following command:

C:\NET USE M: \\HAL9000\PUBLIC

To remove this drive mapping, use the following command:

C:\NET USE M: /DELETE

NET VER

This command displays the type and version of the current redirector.

NET VIEW

The NET VIEW command requests a list of machines that are on the network from the system designated as the master browser. This list is often more up-to-date than what you see in Network Neighborhood. The reason is that the machine list displayed in Network Neighborhood comes from a backup browser that may not have the latest update from the master browser yet.

NETSTAT

C:\Windows\NETSTAT.EXE

The NETSTAT command displays a list of current IP connections as well as protocol statistics. This information is useful in troubleshooting connection problems. The NETSTAT command uses the following switches to modify its output:

PING

C:\Windows\PING.EXE

PING measures the stability of a connection by sending ICMP requests to a remote host and measuring the amount of time it takes to receive a response. You can send a ping to either a machine name or an IP address. To ping the IP address 134.16.27.218, use the following command:

C:\PING 134.16.27.218

ROUTE

C:\Windows\ROUTE.EXE

You can use the ROUTE command to view and manage the routing table. The routing table is a table of static routes that direct traffic across the network. Four subcommands used with the ROUTE command enable you to perform various functions on your routing tables. They are as follows:

To view the current routing table, use the following:

C:\ROUTE PRINT

To add a static route to the routing table that directs all traffic headed to the 234.0.0.0 subnet through the router 186.124.18.1, you would use the following syntax:

C:\ROUTE ADD 234.0.0.0 255.255.255.0 186.124.18.1

To change this route to point to the router 186.124.18.2, you would use the following command:

C:\ROUTE CHANGE 234.0.0.0 255.255.255.0 186.124.18.2

Finally, to delete this route from the routing table, use the following command:

C:\ROUTE DELETE 234.0.0.0

TRACERT

C:\Windows\TRACERT.EXE

TRACERT traces the route to a remote machine. For example, you may want to see how many routers you go through when you connect to www.microsoft.com. You could then use this information to help troubleshoot where connection problems may exist. To trace a route to www.microsoft.com, use the following command:

C:\TRACERT www.microsoft.com

The following switches are available for the TRACERT command:


Previous chapterNext chapterContents

Copyright, Macmillan Computer Publishing. All rights reserved.