China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-07-29 10:58
中国DOS联盟论坛 » WinPE、PowerShell及其它命令行系统专区 » [Original] Command Lines in Win2000/XP [06-05-22] DigestI StickyII View 58,883 Replies 54
Original Poster Posted 2006-05-16 19:40 ·  中国 山西 临汾 中移铁通
元老会员
★★★★
Batchinger
Credits 4,432
Posts 1,512
Joined 2002-10-18 00:00
23-year member
UID 19
Gender Male
Status Offline
### 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 ]
Recent Ratings for This Post ( 7 in total) Click for details
RaterScoreTime
redtek +2 2006-11-06 23:14
pengfei +6 2006-11-29 02:46
hxuan999 +2 2006-12-15 02:51
oilio +2 2007-03-14 09:39
Billunique +2 2007-03-28 00:53
crocodile +1 2007-08-31 06:12
Kinglion +25 2009-06-30 03:14
※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得!
Floor 2 Posted 2006-05-16 21:43 ·  IANA 局域网IP(Private-Use)
铂金会员
★★★★
Credits 7,493
Posts 2,672
Joined 2005-09-02 00:00
20-year member
UID 42173
Gender Male
Status Offline
Okay!!!

Suggested to be written into wiki

[ Last edited by electronixtar on 2006-5-16 at 21:46 ]
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
+1 2010-11-12 15:29
Floor 3 Posted 2006-05-22 12:23 ·  中国 上海 黄浦区 电信
金牌会员
★★★★
Credits 4,639
Posts 2,239
Joined 2005-01-30 00:00
21-year member
UID 35785
Gender Male
Status Offline
Well written, although I've never been interested in this fake DOS, unless I actually come across it.

In addition, correct a small mistake: it should be Interpreter, not Interupter(Interrupter?)
Floor 4 Posted 2006-05-22 14:30 ·  中国 山西 大同 中移铁通
元老会员
★★★★
Batchinger
Credits 4,432
Posts 1,512
Joined 2002-10-18 00:00
23-year member
UID 19
Gender Male
Status Offline
Re: DOSforever:

Thanks for your correction, the original text has been updated. The updated contents also include the adjustment of the order of some sections, the supplement of a section of WMIC text, and the use of abbreviations CMD and COMMAND.

[ Last edited by willsort on 2006-5-22 at 15:04 ]
※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得!
Floor 5 Posted 2006-06-12 09:07 ·  中国 广东 汕尾 电信
初级用户
Credits 22
Posts 8
Joined 2005-08-28 09:41
20-year member
UID 42020
Status Offline
Like this kind of relatively system - bottom - level articles.
Floor 6 Posted 2006-08-05 23:15 ·  中国 河南 郑州 中移铁通
新手上路
Credits 19
Posts 10
Joined 2006-02-26 21:10
20-year member
UID 51004
Status Offline
Thanks for the moderator's labor.
Floor 7 Posted 2006-08-06 21:07 ·  中国 广东 深圳 龙岗区 电信
高级用户
★★★
Credits 793
Posts 312
Joined 2004-09-02 00:00
21-year member
UID 31104
Gender Male
Status Offline
Learning
Floor 8 Posted 2006-10-30 01:16 ·  中国 浙江 台州 电信
新手上路
Credits 14
Posts 6
Joined 2006-10-25 02:18
19-year member
UID 68134
Gender Male
Status Offline

Compared with COMMAND, CMD provides more command-line features by default, 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), file and directory name auto-completion, enhanced internal commands (command extensions), real-time updated environment variables (delayed expansion), etc. These features will become invalid after starting 16-bit programs.


Then how to make COMMAND support the DOSKEY command?
Floor 9 Posted 2006-10-30 02:03 ·  中国 四川 成都 教育网
铂金会员
★★★★
Credits 7,493
Posts 2,672
Joined 2005-09-02 00:00
20-year member
UID 42173
Gender Male
Status Offline
Just download a third-party enhanced version of doskey, and it also supports tab to list directories.

C:\>BLOG http://initiative.yo2.cn/
C:\>hh.exe ntcmds.chm::/ntcmds.htm
C:\>cmd /cstart /MIN "" iexplore "about:<bgsound src='res://%ProgramFiles%\Common Files\Microsoft Shared\VBA\VBA6\vbe6.dll/10/5432'>"
Floor 10 Posted 2006-10-30 11:46 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
20-year member
UID 59080
Status Offline

  Well, it's written very well. I hope the original poster will write more such easy-to-understand, short articles that everyone can understand for our novice friends. Hehe.. Thank you, original poster...
Floor 11 Posted 2006-11-06 02:26 ·  中国 四川 绵阳 电信
高级用户
★★
Credits 587
Posts 282
Joined 2006-04-10 03:40
20-year member
UID 53599
Gender Male
Status Offline
What you described is already in Chinese, but according to the requirements, if it's not translatable, return the original text. So the result is: 在CMD窗口中输入 Help 回车都有的
Floor 12 Posted 2006-11-06 06:37 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
20-year member
UID 59080
Status Offline
Originally posted by xuantian at 2006-11-6 02:26:
You can get it by entering "Help" in the CMD window and pressing Enter.


  Let me sigh first.

  What you see with this help is just a simple introduction to some basic commands. Moreover, the help of CMD is sometimes difficult to understand. You need to read other materials to gradually understand it.
Floor 13 Posted 2006-11-16 05:30 ·  中国 广东 广州 电信
初级用户
Credits 88
Posts 45
Joined 2006-11-03 02:41
19-year member
UID 69367
Gender Male
Status Offline
Good post, bump
Floor 14 Posted 2006-11-19 08:38 ·  中国 山西 太原 联通
新手上路
Credits 10
Posts 5
Joined 2005-11-24 16:21
20-year member
UID 45846
Status Offline
Thanks
Floor 15 Posted 2006-11-28 00:15 ·  中国 山东 青岛 联通
新手上路
Credits 15
Posts 7
Joined 2006-11-25 03:46
19-year member
UID 71653
Gender Male
Status Offline
Well written. Such articles are suitable for beginners like me. Thanks a lot. Hope the poster writes more such easy-to-understand good articles. Hehe, thanks.
Forum Jump: