OverviewThe default command line interface on Windows platforms is cmd.exe. It command line manipulation of the filesystem, the ability to launch programs from the command line, interact with running programs, and other abilities.In addition to the above, cmd.exe supports various programming constructs and utilities for making working with the command line a little easier (such as tab completion). This page documents these programming constructs and utilities. The commands provided by cmd.exe are reported on other pages. The list of commands is available on the Command Line Tools cmd.exe is just a program and can be started in the manner of most other Windows programs. It can be found via the Start button through All Programs > Accessories and then Command Prompt. An alternative mechanism for starting the program is via the Run dialog box. This dialog box can be shown by selecting Run ... from the Start menu, or via the Windows+R keyboard shortcut. In the Run dialog box type cmd.exe and press return. Related Command LinesThere are other command line interfaces available for Windows. Two that provide a more powerful, yet similar, experience to cmd.exe are PowerShell and TakeCommand. PowerShell can be downloaded for free from Windows. TakeCommand is available from JPSoft and comes in three versions: two commercial and one free.It is also possible to get Unix like command lines on Windows. cygwin and GnuWin32 are two such command lines. | ExamplesGetting HelpYou can get help for any command supplied by cmd.exe by adding /? after the command name. For example, to get help on cmd.exe itself, typecmd /? (the .exe extension is optional). Command Line CompletionCommand line completion is the mechanism that allows you to type a few characters of a file or directory, hit a special key (usually the tab key), and cmd.exe completes the rest of the name. This can be a big time saver.By default command line completion is NOT enabled. It can be turned on per invocation of cmd.exe (supply argument /F:ON) but it is such a useful tool that I would advise turning it on by default. This can be done by setting the values for the registry keys HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\CompletionChar HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\PathCompletionChar or HKEY_CURRENT_USER\Software\Microsoft\Command Processor\CompletionChar HKEY_CURRENT_USER\Software\Microsoft\Command Processor\PathCompletionChar to the hex value of the control character you wish to use for character completion. The tab character has hex value 9. (The two sets of registry keys in that the HKEY_LOCAL_MACHINE keys set the value for all users on a Windows install, the HKEY_CURRENT_USER sets only for the current user and overrides HKEY_LOCAL_MACHINE. The difference between CompletionChar and PathCompletionChar is that the value for CompletionChar will cause files and directories to be completed; PathCompletionChar only expands directory names). Registry keys can be edited via the Registry Editor which can be invoked from the Run ... dialog (Windows+R) and type regedit and hit return. Then navigate down through the hierarchy following the key path segments. After setting these keys you can use tab to complete your file and directory names. A few further comments:
|
