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-08-13 09:15
中国DOS联盟论坛 » DOS学习入门 & 精彩文章 (教学室) » DOS concept: console, CON View 1,750 Replies 11
Original Poster Posted 2007-02-04 10:47 ·  中国 江苏 南京 鼓楼区 电信
初级用户
Credits 31
Posts 9
Joined 2007-01-18 22:43
19-year member
UID 76924
Gender Male
Status Offline
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.
Recent Ratings for This Post ( 2 in total) Click for details
RaterScoreTime
redtek +8 2007-02-06 23:22
oilio +1 2007-02-07 02:38
Floor 2 Posted 2007-02-04 19:53 ·  中国 江苏 南京 鼓楼区 电信
初级用户
Credits 31
Posts 9
Joined 2007-01-18 22:43
19-year member
UID 76924
Gender Male
Status Offline
I'm going to write another concept redirection when I have free time.
Floor 3 Posted 2007-02-05 08:25 ·  中国 广东 广州 珠江宽频
中级用户
★★
Credits 210
Posts 85
Joined 2007-01-14 12:38
19-year member
UID 76501
Gender Male
From 广东广州
Status Offline
A concise tutorial supporting more basic concepts is quite helpful for us novices.
Floor 4 Posted 2007-02-05 11:56 ·  中国 浙江 宁波 鄞州畅联信息技术有限公司
初级用户
Credits 122
Posts 9
Joined 2004-01-24 00:00
22-year member
UID 16018
Gender Male
Status Offline
Floor 5 Posted 2007-02-06 12:50 ·  中国 广东 深圳 宝安区 电信
初级用户
Credits 68
Posts 29
Joined 2006-09-09 06:19
19-year member
UID 62210
Gender Male
Status Offline
Not bad. Collected. Hehe.
Floor 6 Posted 2007-02-07 02:39 ·  中国 江苏 连云港 电信
高级用户
★★★
前进者
Credits 641
Posts 303
Joined 2007-01-10 02:57
19-year member
UID 76009
Gender Male
Status Offline
Well, thanks. I know "copy con filename", but I just learned about the target parameter, thanks.
我相信总有一天,总会遇到一个人可以相濡以沫、相吻以湿!
Floor 7 Posted 2007-03-31 13:56 ·  中国 山东 济南 联通
初级用户
Credits 28
Posts 16
Joined 2007-03-31 01:04
19-year member
UID 83437
Gender Male
Status Offline
Floor 8 Posted 2007-03-31 17:39 ·  中国 广东 东莞 电信
新手上路
Credits 17
Posts 9
Joined 2007-03-12 09:25
19-year member
UID 81491
Gender Male
Status Offline
Floor 9 Posted 2007-04-01 00:59 ·  中国 河南 洛阳 电信
初级用户
Credits 34
Posts 15
Joined 2007-03-25 06:54
19-year member
UID 82851
Gender Male
Status Offline
Floor 10 Posted 2007-04-01 13:06 ·  中国 广东 深圳 龙岗区 电信
初级用户
Credits 75
Posts 26
Joined 2007-04-01 12:39
19-year member
UID 83623
Gender Male
Status Offline
Want to learn DOS, so I came here
Floor 11 Posted 2007-04-07 23:56 ·  中国 广东 佛山 奥飞数据BGP机房
新手上路
Credits 14
Posts 8
Joined 2007-04-07 03:48
19-year member
UID 84229
Gender Male
Status Offline
Floor 12 Posted 2007-04-25 10:26 ·  中国 重庆 璧山区 电信
初级用户
Credits 58
Posts 31
Joined 2007-01-06 11:16
19-year member
UID 75621
Gender Male
From 重庆
Status Offline
Learning
Forum Jump: