Using Command-Prompt Functions and Utilities Although most computer users seldom use the command prompt available in all versions of Windows covered on the A+ Certification Exams, it's very important for technicians to know how to use the major command-prompt functions and programs. Command-prompt functions and programs can be used to -
Recover data from systems that can't boot normally. -
Reinstall lost or corrupted system files. -
Print file listings (believe it or not, you can't do this in Windows Explorer or My Computer!). -
Copy, move, or delete data. -
Display or configure certain operating system settings. The following sections discuss the major command-prompt functions and utilities in more detail. Starting a Command-Prompt Session You can start a command-prompt session in Windows by clicking on the Command prompt or MS-DOS prompt option in the Start menu; it's usually located in the Accessories menu on most versions of Windows. However, it's faster to use the Run command: -
Click Start, Run. -
With Windows 9x/Me Type command and click OK. With Windows NT 4.0/2000/XP Type cmd and click OK. caution | Before Windows XP, Search & Find searched all types of files for specified text. However, as initially shipped, Windows XP's Search tool excludes many types of files. Service Pack 1 partially fixes this behavior, as does the Windows XP Application Compatibility Update, October 25, 2001. (Both are available from Windows Update.) To search all file types, you also need to use the Indexing Service and enable the option to index files with unknown extensions. For more information about this problem and its solutions, see Microsoft Knowledge Base article 309173. | Internal Commands Overview Command.com (Windows 9x/Me) and Cmd (Windows NT 4.0/2000/XP) contain the internal commands listed in Table 18.7. Commands marked (RC) can also be used by the Windows 2000/XP Recovery Console. Table 18.7. Major Internal Commands Internal Command | Category | Use | Example | DATE | System management | Views system current date and allows it to be changed | DATE | TIME | System management | Views system current time and allows it to be changed | TIME | COPY [1] (RC) | Disk management | Copies one or more files to another folder or drive | COPY *.* A:\ | DEL [1] (RC) | Disk management | Deletes one or more files on current or specified folder or drive | DEL *.TMP | ERASE [1] (RC) | Disk management | Same as DEL | ERASE *.TMP | DIR [1] (RC) | Disk management | Lists files on current or specified folder or drive | DIR *.EXE | MD [1] (MKDIR) (RC) | Disk management | Makes a new folder (subdirectory) | MD TEMP | CD [1] (CHDIR) (RC) | Disk management | Changes your current location to the specified folder (subdirectory) | CD TEMP | RD [1] (RMDIR) (RC) | Disk management | Removes an empty folder | RD TEMP | RENAME (REN) [1] | Disk management | Renames a file | REN joe.txt jerry.txt | VER [1] | System management | Lists the version of operating system in use | VER | VOL | Disk management | Lists the current volume label and serial number for the default drive | VOL | SET [1] | System management | Used to set options for a device or program; SET without options displays all current SET variables | SET TEMP=C:\TEMP | PROMPT | System management | Sets display options for the command prompt | PROMPT=$P $G (displays drive letter followed by greater-than sign) | PATH | System management | Sets folders or drives that can be searched for programs to be run | PATH=C:\DOS;C:\WINDOWS | ECHO [1] | Batch files | Turns on or off the echo (display) of commands to the screen | ECHO OFF | CLS (RC) | Batch files, system management | Clears the screen of old commands and program output | CLS | LH (LOADHIGH) | Memory management (Windows 98) | Loads TSR programs above 640K (see preceding memory-management discussion) | LH C:\MOUSE\MOUSE.COM | TYPE [1] (RC) | System management | Views text files onscreen | TYPE AUTOEXEC.BAT | [1] See the Windows Command Reference on the CD for details and syntax . Because these commands are built into the command interpreter, they can also be used from the command prompt if you boot the computer with the Windows 9x/Me Emergency Boot Disk. All but LH (Loadhigh) can also be run from the Windows 2000/XP command prompt. | You can also use command to create a command prompt in Windows NT 4.0/2000/XP. This mode is sometimes referred to as Windows DOS; it is used automatically if you run a DOS program within these versions of Windows. However, creating a command prompt with command is not recommended for most situations because you cannot use the enhancements to internal or external commands available with cmd . | Using Wildcards to Specify a Range of Files Command-prompt functions and utilities can be used to operate on a group of files with similar names by using one of the following wildcard symbols: For example, DIR *.EXE displays files with the .EXE extension in the current folder (directory). DEL MYNOVEL??.BAK removes the following files: MYNOVEL00.BAK , MYNOVEL01.BAK , but not MYNOVEL.BAK . Windows Command-Prompt Utilities Command-prompt utility programs are found in these locations in Windows 9x/Me: tip | To get help for any internal or external command-prompt function or program, type the program name followed by /? . For example, DIR/? displays help for the DIR command. | | For more information about the Windows 9x Emergency Startup Disk, see "Creating a Boot Disk Suitable for Hard Disk Preparation," p. 484 . | Most of these commands can also be run from the Windows NT/2000/XP command prompt or from the Windows 2000/XP Recovery Console, which can be started from the Windows CD-ROM or can be installed to the hard disk for troubleshooting startup problems. These utilities are also referred to as external commands because, unlike the built-in commands stored in Command.com or Cmd , each of these are separate programs. | Windows NT/2000/XP's command-prompt utilities are typically found in the System32 folder beneath the default Windows folder. | Table 18.8 lists the major command-prompt utilities supplied with Windows, how each is used, and whether it is part of the Windows 98 Emergency Boot Disk, Windows 95 Startup disk, or the Windows 2000/XP Recovery Console. Table 18.8. Major Windows Command-Prompt Utilities Utility | How Used | Supported at Command Prompt by Windows Versions | Windows 98 EBD | Windows 2000/XP Recovery Console | ATTRIB.EXE [2] | Changes file attributes | All | Yes [1] | Yes | CHKDSK.EXE | Simple disk repair and statistics reporting tool ( replaced by ScanDisk in Windows 98) | All | Yes [1] | Yes | CVT.EXE | Converts FAT16 drive to FAT32 file system | 98, Me | | N/A | DEBUG.EXE | Debugging utility | All | Yes [1] | No | DELTREE.EXE [2] | Deletes folders and files contained in folders | 98, Me | | N/A | EXTRACT.EXE | Used to manually uncompress files from Windows .CAB compressed archives | All | Yes | N/A | EXPAND.EXE | Used to manually extract files from Windows .CAB archive files | NT, 2000, XP | N/A | Yes | FDISK.EXE | Partitions hard disks | 9x, Me | Yes | N/A | MEM.EXE [2] | Displays overall memory usage and programs in conventional memory | All | No | No | MOVE.EXE | Moves files from one location to another | All | No | No | MSCDEX.EXE [2] | Provides access to CD-ROM drives after CD-ROM device drive is loaded in Config.sys | 9x, Me (EBD) | Yes [1] | N/A | SCANDISK.EXE | Disk repair and disk statistics tool (replaces CHKDSK ) | 9x, Me | Yes [1] | N/A | SCANREG.EXE | Registry repair tool | 98, Me | No | N/A | UNINSTAL.EXE | Uninstalls Windows 98 | 98 | Yes [1] | N/A | xcopy.exe [2] | Faster version of COPY that can create folders and copy files based on many different criteria | All | No | No | xcopy32.exe [2] | Used in place of standard Xcopy when run from a DOS Window while the Windows 9x/Me GUI is active; supports long filenames and additional options | 9x, Me | No | N/A | DISKCOPY.COM | Makes a bit-by-bit exact copy of a diskette | All | No | No | DOSKEY.COM | Enables user to cycle through previous command-prompt commands for reuse | All | No | Not necessary | EDIT.COM [2] | DOS-based text editor | All | Yes [1] | No | FORMAT.EXE | High-level formatter for hard and floppy drives | All | Yes [1] | Yes | SYS.COM | Transfers system files to formatted hard or floppy drives | 9x, Me | Yes [1] | N/A | SETVER.EXE [2] | Enables older software to run without triggering an "incorrect MS-DOS version" error | 9x, NT, 2000, XP | No | N/A | [2] For more details and command syntax, see the Windows Command Reference on the CD packaged with this book [1] Extracted to RAMDISK created when EBD is used to start computer Windows 95's Startup disk contains all the Windows 98 EBD files listed in the table except for Debug and Mscdex . You can copy these files manually from the \Windows\System folder to the Startup disk if needed. For more information about the Windows 2000/XP Recovery Console, see "Windows Recovery Console," in Chapter 20. The command-prompt utilities listed in Table 18.9 are part of Windows NT 4.0/2000/XP only. For a more complete list, type HELP from the Windows NT/2000/XP command prompt. To see command options, type /? after each command. Table 18.9. Windows NT/2000/XP-Only Command-Prompt Utilities Utility | How Used | Assoc | Displays or changes file extension associations | At | Schedules the running of commands or programs | Cacls | Displays or changes access control lists (ACLs) of files | Chkntfs | Displays or changes the operation of Chkdsk at startup time | Compact | Displays or changes the current compression status of files on NTFS partitions only | Convert | Converts FAT partitions other than the current drive to NTFS | Ftype | Displays or changes file types used in file extension associations | Title | Sets window title for a command-prompt ( CMD.EXE ) session | Getting Help with a Particular Command Most command-line functions and utilities provide you with concise help for options; type the command name followed by /? to see options for that command. tip | Most Windows 9x command-prompt commands and utilities have similar options to those used by MS-DOS 6.x. The MS-DOS 6.x Help file (which contains more detailed help and examples than those provided by /? help) is stored on the Windows 9x CD-ROM in the OldMSDOS folder. To view the help file, switch to that folder and open Help.com . | |