Using DOS Commands in Windows 8

Readers who have used personal computers since the DOS days might still wish to enter the occasional DOS command. DOS commands will let you do things you can’t really do in Windows. For example, in those rare instances where you can’t delete a file in Windows, using a DOS erase or del command with the /F switch will often do the trick. You can use the DOS dir command to print filenames from a folder to paper or a text file.

There is one big catch to using commands in Windows 8. User Account Control (UAC) may prevent you from doing things you’d otherwise take for granted. You can get around many of those by using the Run As Administrator option to open the command prompt. Here are two different ways to open the Command Prompt window:

  • From the desktop, press Windows+X and click Command Prompt.
  • Display the Charms Bar, click Search, and type cmd. Choose cmd.exe or right-click cmd.exe and choose Run As Administrator (see Figure 39.6).

    FIGURE 39.6 Open Command Prompt

    image

The Command Prompt window that opens is much like DOS. By default, you’re taken to the home directory for your user account. But you can navigate around using the DOS cd command. For example, enter cd.. to go to the parent directory, or cd “program files” to go to the Program Files folders.

To see a list of all supported commands, enter help at the command prompt. For the syntax of a command, ...

Get Windows 8 Bible now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.