中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-13 10:16
47,811 topics / 349,897 posts / today 0 new / 48,256 members
DOS学习入门 & 精彩文章 (教学室) » DOS concept: console, CON
Printable Version  1,752 / 11
Floor1 freetree Posted 2007-02-04 10:47
初级用户 Posts 9 Credits 31
DOS Concepts: Console, CON

By default, the DOS system receives user instructions from the keyboard and outputs the execution results of commands to the display screen. When the syntax or error message of a DOS command mentions the console, it actually refers to the monitor and keyboard as a unit.

The DOS system has an internal device driver called CON, which allows users to access the console when a printer or other device is connected to the system. The most important thing to remember about the console CON is: when a DOS command refers to CON, if CON is used as a source parameter, then CON refers to the keyboard; if CON is used as a target parameter, then CON refers to the screen.

Please see the following two examples.

Example 1. Create a batch file TIMEDATE.BAT.
COPY CON TIMEDATE.BAT
TIME
DATE
^Z

We are concerned with the command "COPY CON TIMEDATE.BAT". Here, CON is the source parameter, referring to the keyboard, and TIMEDATE.BAT is the target file. The whole sentence means that it copies from the keyboard to the TIMEDATE.BAT file.

Example 2. Look at the opposite process of Example 1.
COPY CONFIG.SYS CON

Here, CONFIG.SYS is the source file, and CON is the target parameter, referring to the screen. The whole sentence means that it copies CONFIG.SYS to the screen, and its function is equivalent to TYPE CONFIG.SYS.

Example 3. Use the printer as a typewriter.
COPY CON PRN

Here, CON is the source parameter, which is the keyboard, and the target parameter is PRN (printer driver, accessing the printer connected to LPT1). After executing this command, DOS waits for the user to input from the keyboard. When the input is finished, press F6 and enter, and the printer will immediately output the text that the user just entered.
Floor2 freetree Posted 2007-02-04 19:53
初级用户 Posts 9 Credits 31
I'm going to write another concept redirection when I have free time.
Floor3 lizaoyou Posted 2007-02-05 08:25
中级用户 Posts 85 Credits 210 From 广东广州
A concise tutorial supporting more basic concepts is quite helpful for us novices.
Floor4 gqnboy Posted 2007-02-05 11:56
初级用户 Posts 9 Credits 122
Floor5 gxsanhen Posted 2007-02-06 12:50
初级用户 Posts 29 Credits 68
Not bad. Collected. Hehe.
Floor6 oilio Posted 2007-02-07 02:39
高级用户 Posts 303 Credits 641
Well, thanks. I know "copy con filename", but I just learned about the target parameter, thanks.
Floor7 yhl Posted 2007-03-31 13:56
初级用户 Posts 16 Credits 28
Floor8 lyflpf Posted 2007-03-31 17:39
新手上路 Posts 9 Credits 17
Floor9 vsda2008 Posted 2007-04-01 00:59
初级用户 Posts 15 Credits 34
Floor10 skywalker Posted 2007-04-01 13:06
初级用户 Posts 26 Credits 75
Want to learn DOS, so I came here
Floor11 jamessjm Posted 2007-04-07 23:56
新手上路 Posts 8 Credits 14
Floor12 netchxing Posted 2007-04-25 10:26
初级用户 Posts 31 Credits 58 From 重庆
Learning
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023