You are on page 1of 3

How to Use Command Line Shortcuts

Page 1 of 3

Click Here to Install Silverlight

United States Change | All Microsoft Sites

Search Microsoft.com
Windows XP Home Windows XP Editions Home Edition Professional Media Center Edition Tablet PC Edition Professional x64 Edition Information For Home Users Students Small Businesses IT Professionals Developers Resources Using Windows XP Downloads Support Expert Zone Worldwide Sites Microsoft Update Windows Marketplace Windows Family
Published: March 1, 2004 By Joli Ballew, Windows XP Expert Zone Community Columnist Using Windows XP

Submit Query

| Security At Home | Microsoft At Home | Microsoft At Work

How to Use Command Line Shortcuts

Back in "the day", I was one of those people who enjoyed showing off my command line prowess to astonished friends and family. I even took an MS-DOS class in 1983 (keep the snickering down, please). The command line is a user interface to a computer's operating system, which allows the user to type commands and get responses directly from the system. Commands are entered at a command prompt, a symbol that indicates a command is expected. Generally a command prompt looks like this: C:\>. Depending on your age and level of technical expertise, you may have had a little experience in the command-line interface field yourself. As computers evolved, most users got away from the commandline tools and began depending solely on the graphical user interface. Recently I discovered the command line again, and to be honest, I'm feeling a little nostalgic. Yes Virginia, there really is a command line, and it's alive and well in Windows XP. Why would you use command-line tools when Windows XP already provides a graphical user interface to handle these tasks? There are many reasons for taking the time to learn how to work "under the hood" of the computer, among them:

Related Links Have more questions?


Discuss this article in the Windows XP Security and Administration Newsgroup

Command Shell Overview NTFS vs. FAT: Which is


Right for You?

Windows XP Command
Line Utilities

MyITforum:
Driverquery.exe

NTFS chkdsk.exe Update TechNet Command-Line


Reference

Using the command line often offers a faster way to perform a task, such as renaming multiple files or folders. Working from the command-line interface uses fewer resources than working from inside the graphical user interface. Creating powerful and multifaceted commands by stringing commands together is easily accomplished. Working from the command line may even inspire you to become a computer programmer!

Previous Columns by Joli


Ballew

Buy the Book Microsoft Windows XP: Do Amazing Things

You can use command line shortcuts to automate routine tasks, such as shutting down your system and viewing system information. They're also useful for scanning and repairing protected system files and identifying problems with a hard disk. For more information on the command line interface, read the definition at WhatIs.com. TechNet also provides good coverage in the Command Shell Overview.

In this column, I share some of my favorite command-line tools and shortcuts, including how to recover data, send a message to other computers on a network, and find a complete list of system drivers. It'll be great fun, and I promise not to let you foul anything up while we do it.

Configure the Command Prompt Window


If you want to use a command prompt to perform system tasks, it's worth the few minutes it takes to create a shortcut to the command prompt window on the desktop. Then configure how the command prompt window looks each time you open it. If you've never used the command prompt, this is a good way to do a little exploring. Note that some command-line tools require the user to have administrator-level privileges. To create a shortcut on the Desktop and configure the command prompt window with your personal preferences, follow these steps: 1. 2. 3. Click Start, point to All Programs, point to Accessories, and right-click Command Prompt. Point to Send To, and then click Desktop (create shortcut). Double-click the new Command Prompt icon on the desktop, and in the Command Prompt window, click the command prompt icon on the title bar, and then click Properties. See Figure 1.

Figure 1

4.

On the Options tab, if desired, change the Cursor Size, Display Options, and Edit Options. (QuickEdit Mode lets you use your mouse to cut and paste, bypassing the Edit menu.) Don't make any changes to the Buffer Size settings. On the Font tab, if desired, change the Window Preview or Font. On the Layout tab, if desired, change the Screen Buffer Size, Windows Size, or Windows Position. On the Colors tab, if desired, change the Screen Text, Screen Background, Popup Text, or Popup Background colors. Click OK.

5. 6. 7.

Top of page

Command-Line Shortcuts for Beginners


After careful research done in the Windows XP online community, I've decided these command-line shortcuts are best for beginners:

shutdown for shutting down the system convert for converting a FAT file system to NTFS

To get more information about any command, type command name /?. Then press Enter.

Shut Down the System


Although shutting down the computer from the Start menu is faster and easier, the shutdown command can also be issued at a command prompt to shut down the computer. The shutdown command also offers parameters to log off a user, restart the computer, and abort a system shutdown. If you ever have to boot

http://www.microsoft.com/windowsxp/using/helpandsupport/learnmore/ballew_commandli...

2/2/2011

How to Use Command Line Shortcuts

Page 2 of 3

to the command-line to troubleshoot a problem, you'll want to know how this command works. To shut down the computer and experiment with other options: 1. 2. Close all open programs to avoid loss of data. Open Command Prompt from the shortcut created in the previous section or by clicking Start, pointing to All Programs, pointing to Accessories, and clicking Command Prompt. At the command prompt, type shutdown -s. Press Enter or Return on the keyboard. A shutdown dialog box opens. To abort the shutdown in progress, at the command prompt, type shutdown -a.

3. 4.

Other options include -r to restart the system, -m \\computername to shut down a remote computer, and -l to log off of the computer. To see all the options, type shutdown /? at the command prompt.

Convert a FAT File System to NTFS


If your file system is configured as FAT instead of NTFS, you're missing out on quite a few extra perks. Using NTFS, you get increased security, file compression, disk quotas, and encryptionfeatures you don't get with FAT. For the pros and cons of both file systems, read Charlie Russel's article, NTFS vs. FAT: Which is Right for You? If you do decide to convert, it's quite simple: 1. 2. Close all open programs to avoid loss of data. Be prepared to restart your computer. Open Command Prompt, and at the command prompt, type convert C: /FS:NTFS, where C represents the drive letter of the disk to convert. Press Enter or Return on the keyboard. Wait while the process completes. Don't do anything while the conversion is taking place.

3.

You can also open a Command Prompt from the Run line (available from the Start menu). Just type cmd and press Enter.
Top of page

Command Line Shortcuts for Intermediate Users


There are several popular command line shortcuts for intermediate users. The ones I'll introduce here can be used to monitor, troubleshoot, and repair a computer system, and are widely acknowledged in the Windows XP community as the best command-line tools available. In this section, you'll learn about the following:

sfc for scanning, finding, and replacing missing protected system files driverquery for viewing a complete list of drivers and their properties chkdsk for scanning and repairing problems on a hard disk.

See Windows XP Command Line Utilities for a list of command prompts that work with Windows XP.

Scan, Find, and Replace Missing System Files


The System File Checker (SFC) can be used at a command prompt to scan protected system files and replace any files that are missing. Missing system files can be the cause of various problems, including startup and shutdown problems, and .dll errors. If you're receiving errors relating to protected system files, this utility might just solve the dilemma. 1. 2. Locate your Windows XP CD, and place it in the CD-ROM drive. When prompted what to do, choose Exit. Close any other open programs. Open the command prompt window from the shortcut created in the previous section or click Start, point to All Programs, point to Accessories, and then click Command Prompt. At the command prompt, type sfc /scannow. Press Enter or Return on the keyboard. Wait while the process completes. Don't do anything while the verification is taking place.

3. 4.

View a Complete List of Drivers


Another popular and useful command line tool is driverquery. Intermediate users and network administrators can use this command to view a list of all installed device drivers and their properties. Driverquery command parameters can be added that allow the information to be output in a table, a list, or using comma separated values, all of which can be used to save the information for later use. There's even a command to output only information about signed device drivers. To see a complete list of the device drivers on a computer:

At a command prompt, type driverquery, and then press Enter.

To format the information in a table: At a command prompt, type driverquery /fo:table, and then press Enter.

To format the information in a list: At a command prompt, type driverquery /fo:list, and then press Enter.

To format the information using comma-separated values: At a command prompt, type driverquery /fo:csv, and then press Enter.

To view only signed device drivers:

At a command prompt, type driverquery /si. Figure 3 shows an example of signed driver information presented in a list.

http://www.microsoft.com/windowsxp/using/helpandsupport/learnmore/ballew_commandli...

2/2/2011

How to Use Command Line Shortcuts

Page 3 of 3

Figure 3

There's a short but informative article about this command at MyITForum, by author Larry Duncan.

Scan and Repair Problems with a Hard Disk


Chkdsk creates and displays a status report for a hard disk and can correct errors on the disk if desired. Used without any parameters, chkdsk simply displays the status of the disk in the current drive. Used with parameters, chkdsk can locate bad sectors, repair the disk, and recover readable information. To see a status report of the disk, at a command prompt, type chkdsk and press Enter. If errors are found, an error message will appear as shown in Figure 4.

Figure 4

To repair errors with the disk, at a command prompt, type chkdsk /f/r and press Enter. The parameter /f fixes errors on the disk; /r locates bad sectors and recovers readable information. If you receive a message that Chkdsk can't run because the volume is in use by another process, this probably means you're trying to fix errors on the disk that you're currently using. You can't do that, but the computer can repair errors at startup, and you should schedule an appointment to do that. Note: If you have trouble with chkdsk running at system boot, download the chkdsk.exe update patch here.
Top of page

Command Line Shortcuts for Advanced Users


There are several advanced command-line tools, created and intended for network administrators and advanced users. If you're interested, experiment with these command line options:

Bootcfguse this command to configure, query, or change the boot.ini file settings. Be careful about making changes here! Gpresultuse this command to test Group Policy and obtain general information about the operating system, the user, and the computer, including the build number and Service Pack details, user name, domain name, profile type, security privileges, disk quota information, and the last time a policy was applied. Recoveruse this command to recover readable information from a bad or defective disk. Schtasksuse this command to schedule programs to run at a specific time or at specified intervals.

To see a complete list of available commands for Windows XP, including the newest additions, check out the Command Line Reference page at Microsoft TechNet. Joli Ballew is a full-time writer and author of several books, including Microsoft Windows XP: Do Amazing Things (Microsoft Press) and Windows XP Professional: The Ultimate User's Guide, Second Edition (Paraglyph Press). In addition to writing, Joli teaches classes at Eastfield Community College and is an artist and network administrator at North Texas Graphics.

Top of page Printer-Friendly Version Send This Page Add to Favorites

Manage Your Profile | Contact Us | Free Newsletter | RSS Feeds 2011 Microsoft Corporation. All rights reserved. Contact Us | Terms of Use | Trademarks | Privacy Statement

http://www.microsoft.com/windowsxp/using/helpandsupport/learnmore/ballew_commandli...

2/2/2011

You might also like