Many people who are new to computers will never have heard of the command line, also known as the command prompt, and sometimes (but incorrectly) called the DOS prompt. (DOS was the operating system used by most PCs before Windows became ubiquitous. The command line in DOS was the only way to start programs and manage files, and the command prompt in Windows borrows many of the command names from DOS but with vastly improved capabilities.) Users of older PCs may remember the command line, but they may be under the impression that it's purely a thing of the past. Advanced users, on the other handwhether they remember the old days of the DOS command line or nothave probably learned the advantages of the command-line interface, even when using Windows Vista on a day-to-day basis.
You can perform many tasks faster by typing one or more commands into the Command Prompt window. In addition, some of the programs in Windows Vista are command-line-based tools, and you can run them from the command prompt as well as from the GUI. For full documentation on the command line and the Command Prompt application, see Chapter 14.
At the command prompt, you can get help on the available command-line options by typing:
You can see a list of all built-in command-line utilities by typing help and pressing Return.
When you run some command-line programs, such as openfiles, which displays all currently open files, you may get an error message similar to this: ERROR: Logged-on user does not have administrative privilege. You may get this message even if you are using an administrator account. There is a workaround: type cmd at the Start Search box on the Start menu (don't press Enter), right-click the "cmd" entry that appears at the top of the search results, and then choose Run as Administrator. You'll now be able to run any command-line program, such as openfiles, that gives you that error message.
Here are a few examples that show how you can use the command line as an alternative to the GUI:
To create a folder called sample in the root directory of your hard disk and then copy all the files from another folder into the new folder, for example, it can be quicker and easier to type:
C:\>copy d:\stuff\*.* \sample
than to open Windows Explorer, navigate to your d:\stuff folder, select all the files, click File Copy (or Ctrl-C), navigate to the new location, click New Folder, type the folder name, open the new folder, and then click Edit Paste (or Ctrl-V) to copy in the files. That's a heck of a sentence, and a heck of a lot of steps for what you can accomplish with the two simple commands shown here.
Once you learn the actual filename of a program rather than its Start menu shortcut name, it can be quicker to start it from the Run prompt or the Address Bar than it is to navigate the Start menu hierarchy. Which is really easier? Clicking your way through these menus:
- Start Programs Accessories System Tools Character Map
into the Start menu's Search box or Explorer's Address Bar and pressing the Enter key? Typing a command is much faster than carefully dragging the mouse through cascading menus, where an unintentional slip of the mouse can get you somewhere entirely different from what you planned.
Finally, many useful programs don't appear on any menu in the Start menu. Once you know what you're doing, you can put shortcuts to such programs in the Start menu or on the Desktopbut once you know what you're doing, you might also find it easier to just type the program name.