### Command Lines in Win2000/XP
Updated: 2006-05-22
The command line environments supported by default in Windows 2000/XP are mainly two: cmd.exe (hereinafter referred to as CMD) and command.com (hereinafter referred to as COMMAND). Although they are similar to DOS in many aspects, they are not DOS. They are just the shell interfaces of the Windows operating system, while DOS (such as MS-DOS, FreeDOS, etc.) is an independent operating system.
CMD is the most commonly used command line environment, providing support for all command line programs in the system, including 32-bit PE format console programs and 16-bit MZ format DOS programs; but it itself is a 32-bit PE program, so an environment needs to be simulated before running 16-bit DOS programs, that is, "NT Virtual DOS Machine (NT Virtual DOS Machine, referred to as NTVDM)", which is supported by ntvdm.exe in %SystemRoot%\system32. Therefore, when we just open CMD, the process manager will show the cmd.exe process, and when a 16-bit DOS program (such as debug) is run in it, an additional ntvdm.exe process will appear.
COMMAND is a compatibility command line environment for running 16-bit DOS programs. This environment is still provided by ntvdm.exe, and COMMAND is no longer an independent "command interpreter", but just an entry of a 16-bit command line environment designed to be compatible with low-version systems. Therefore, after running COMMAND, there is only one ntvdm.exe process in the process manager, and there will be no command.com process.
### CMD vs COMMAND
Compared with COMMAND, CMD provides more default command line features, such as multi-language display and input method (code page), more perfect fonts (TrueType), scrollable windows (screen buffer), command line history and macro commands (DOSKEY), automatic completion of file and directory names, enhanced internal commands (command extensions), real-time updated environment variables (delayed expansion), etc. These features will become invalid after starting 16-bit programs.
Compared with CMD, COMMAND is more like a virtual PC, and many hardware and software environments required for running 16-bit programs can be simulated through it. Its startup process is similar to DOS, configuring the memory environment through %SystemRoot%\system32\config.nt and loading the required hardware drivers, and executing some tasks that need to be automatically executed when starting the virtual environment through %SystemRoot%\system32\autoexec.nt.
### Chinese in the Command Line
Although the CMD in the Simplified Chinese version of Windows 2000/XP supports the Chinese code page (936) by default, this is only for 32-bit programs; after using 16-bit programs, due to the influence of ntvdm.exe, the code page will be forcibly switched back to English (437), so not only can Chinese not be displayed normally, but there are often error prompts of "Invalid keyboard code specified"; while COMMAND only supports the English code page and cannot use chcp to switch the code page.
The solution to this problem is graftabl.exe, a tool that enables the function of displaying extended character sets in graphic mode, which can make 16-bit programs still display Chinese in the English code page environment.
If in CMD, first run chcp 437 to switch the internal code page to English, then run graftabl 936 to enable the Chinese character set display, then no matter whether 16-bit programs are run or not, the output code page is Chinese, but at this time, Chinese input method cannot be used to input Chinese.
If in COMMAND, the internal code page is already English, you can directly run graftabl 936 to enable the Chinese character set display, at this time, Chinese can be displayed in COMMAND, but Chinese input cannot be made either.
If in a batch script, write chcp 437>nul and graftabl 936>nul in advance, which can ensure that Chinese is displayed normally when 16-bit programs are run later.
### Other Important Command Lines
"Recovery Console" is a command line environment provided on the Windows 2000/XP installation disc, mainly used for repairing system failures, and is not installed in the system by default.
"PowerShell" is a command line tool for the next generation of Windows and will be a replacement for CMD, but it is not currently included in the default configuration of Windows 2000/XP, and it requires the support of.Net Framework 2.0.
"Microsoft Management Console Command Line" provides a simple interface to WMI, so that you can use WMI to manage computers running Microsoft Windows, providing a convenient way to browse and manage system resources in command line or script mode. It is a new tool brought by Windows XP, and initialization installation configuration will be automatically carried out when it is run for the first time.
### Related Concepts
Command Processor/Command Interpreter
A separate software program that can provide direct communication between the user and the operating system. The non-graphic command line interpreter user interface provides an environment for running character-based applications and utilities. The command processor executes programs and displays their output on the screen by using various characters similar to the MS-DOS command interpreter command.com. The Windows server operating system (NT) command line interpreter uses the command interpreter cmd.exe (which loads applications and directs the flow of information between applications) to convert user input into a form that the operating system can understand.
Command Prompt
1. A shortcut of the command line interpreter cmd.exe, which can open a CMD window and is generally located in "Accessories" in the Start menu;
2. The prompt text before entering each command in the command line, usually the current path information, which can be modified through the environment variable PROMPT;
Shell/Interface
A program or module in the operating system or other systems responsible for realizing the interaction between the user and the system kernel. Typically, the resource explorer (explorer.exe) and the command line interpreter (cmd.exe) are both shells of the Windows system. The former belongs to the graphical user interface (Graphic User Interface, GUI), and the latter belongs to the command line interface (Command Line Interface, CLI).
Console
1. An environment for intensive control and parameter configuration of the system. For example, the console of the graphical interface is "Microsoft Management Console (Microsoft Management Console, MMC)", and the command line interface is "Command Line Interpreter (cmd)" and "Microsoft Management Console Command Line (wmic)".
2. An input and output device in the command line environment, code-named con, which can usually be regarded as a combination of a keyboard and a screen.
[ Last edited by willsort on 2006-5-22 at 15:03 ]
Updated: 2006-05-22
The command line environments supported by default in Windows 2000/XP are mainly two: cmd.exe (hereinafter referred to as CMD) and command.com (hereinafter referred to as COMMAND). Although they are similar to DOS in many aspects, they are not DOS. They are just the shell interfaces of the Windows operating system, while DOS (such as MS-DOS, FreeDOS, etc.) is an independent operating system.
CMD is the most commonly used command line environment, providing support for all command line programs in the system, including 32-bit PE format console programs and 16-bit MZ format DOS programs; but it itself is a 32-bit PE program, so an environment needs to be simulated before running 16-bit DOS programs, that is, "NT Virtual DOS Machine (NT Virtual DOS Machine, referred to as NTVDM)", which is supported by ntvdm.exe in %SystemRoot%\system32. Therefore, when we just open CMD, the process manager will show the cmd.exe process, and when a 16-bit DOS program (such as debug) is run in it, an additional ntvdm.exe process will appear.
COMMAND is a compatibility command line environment for running 16-bit DOS programs. This environment is still provided by ntvdm.exe, and COMMAND is no longer an independent "command interpreter", but just an entry of a 16-bit command line environment designed to be compatible with low-version systems. Therefore, after running COMMAND, there is only one ntvdm.exe process in the process manager, and there will be no command.com process.
### CMD vs COMMAND
Compared with COMMAND, CMD provides more default command line features, such as multi-language display and input method (code page), more perfect fonts (TrueType), scrollable windows (screen buffer), command line history and macro commands (DOSKEY), automatic completion of file and directory names, enhanced internal commands (command extensions), real-time updated environment variables (delayed expansion), etc. These features will become invalid after starting 16-bit programs.
Compared with CMD, COMMAND is more like a virtual PC, and many hardware and software environments required for running 16-bit programs can be simulated through it. Its startup process is similar to DOS, configuring the memory environment through %SystemRoot%\system32\config.nt and loading the required hardware drivers, and executing some tasks that need to be automatically executed when starting the virtual environment through %SystemRoot%\system32\autoexec.nt.
### Chinese in the Command Line
Although the CMD in the Simplified Chinese version of Windows 2000/XP supports the Chinese code page (936) by default, this is only for 32-bit programs; after using 16-bit programs, due to the influence of ntvdm.exe, the code page will be forcibly switched back to English (437), so not only can Chinese not be displayed normally, but there are often error prompts of "Invalid keyboard code specified"; while COMMAND only supports the English code page and cannot use chcp to switch the code page.
The solution to this problem is graftabl.exe, a tool that enables the function of displaying extended character sets in graphic mode, which can make 16-bit programs still display Chinese in the English code page environment.
If in CMD, first run chcp 437 to switch the internal code page to English, then run graftabl 936 to enable the Chinese character set display, then no matter whether 16-bit programs are run or not, the output code page is Chinese, but at this time, Chinese input method cannot be used to input Chinese.
If in COMMAND, the internal code page is already English, you can directly run graftabl 936 to enable the Chinese character set display, at this time, Chinese can be displayed in COMMAND, but Chinese input cannot be made either.
If in a batch script, write chcp 437>nul and graftabl 936>nul in advance, which can ensure that Chinese is displayed normally when 16-bit programs are run later.
### Other Important Command Lines
"Recovery Console" is a command line environment provided on the Windows 2000/XP installation disc, mainly used for repairing system failures, and is not installed in the system by default.
"PowerShell" is a command line tool for the next generation of Windows and will be a replacement for CMD, but it is not currently included in the default configuration of Windows 2000/XP, and it requires the support of.Net Framework 2.0.
"Microsoft Management Console Command Line" provides a simple interface to WMI, so that you can use WMI to manage computers running Microsoft Windows, providing a convenient way to browse and manage system resources in command line or script mode. It is a new tool brought by Windows XP, and initialization installation configuration will be automatically carried out when it is run for the first time.
### Related Concepts
Command Processor/Command Interpreter
A separate software program that can provide direct communication between the user and the operating system. The non-graphic command line interpreter user interface provides an environment for running character-based applications and utilities. The command processor executes programs and displays their output on the screen by using various characters similar to the MS-DOS command interpreter command.com. The Windows server operating system (NT) command line interpreter uses the command interpreter cmd.exe (which loads applications and directs the flow of information between applications) to convert user input into a form that the operating system can understand.
Command Prompt
1. A shortcut of the command line interpreter cmd.exe, which can open a CMD window and is generally located in "Accessories" in the Start menu;
2. The prompt text before entering each command in the command line, usually the current path information, which can be modified through the environment variable PROMPT;
Shell/Interface
A program or module in the operating system or other systems responsible for realizing the interaction between the user and the system kernel. Typically, the resource explorer (explorer.exe) and the command line interpreter (cmd.exe) are both shells of the Windows system. The former belongs to the graphical user interface (Graphic User Interface, GUI), and the latter belongs to the command line interface (Command Line Interface, CLI).
Console
1. An environment for intensive control and parameter configuration of the system. For example, the console of the graphical interface is "Microsoft Management Console (Microsoft Management Console, MMC)", and the command line interface is "Command Line Interpreter (cmd)" and "Microsoft Management Console Command Line (wmic)".
2. An input and output device in the command line environment, code-named con, which can usually be regarded as a combination of a keyboard and a screen.
[ Last edited by willsort on 2006-5-22 at 15:03 ]
Recent Ratings for This Post
( 7 in total)
Click for details
※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得!

DigestI
StickyII