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-12 09:27
中国DOS联盟论坛 » DOS学习入门 & 精彩文章 (教学室) » 【Help】How to create a TXT file under DOS View 1,828 Replies 5
Original Poster Posted 2010-10-07 22:41 ·  中国 陕西 西安 电信
初级用户
Credits 30
Posts 14
Joined 2010-10-06 00:30
15-year member
UID 175359
Gender Male
Status Offline
How to create a TXT file under DOS
Floor 2 Posted 2010-10-07 23:30 ·  中国 重庆 电信
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline

echo CN-DOS>a.txt
Floor 3 Posted 2010-10-08 15:51 ·  中国 江苏 盐城 联通
新手上路
Credits 21
Posts 9
Joined 2006-01-09 13:27
20-year member
UID 48674
Status Offline
First line command: copy con new.txt
Second line: Enter your text
Last line end command: ctrl+Z
Floor 4 Posted 2010-10-08 18:38 ·  中国 陕西 西安 电信
初级用户
Credits 30
Posts 14
Joined 2010-10-06 00:30
15-year member
UID 175359
Gender Male
Status Offline
Thanks to the moderator. But after running this command, the file content is CN-DOS. How to make this file empty?
Floor 5 Posted 2010-10-08 18:41 ·  中国 陕西 西安 电信
初级用户
Credits 30
Posts 14
Joined 2010-10-06 00:30
15-year member
UID 175359
Gender Male
Status Offline
Originally posted by sytyh at 2010-10-8 15:51:
First command: copy con new.txt
Second line: Enter your text
Last line end command: ctrl+Z

Test passed, thanks a lot!
Floor 6 Posted 2010-10-08 18:52 ·  中国 陕西 西安 电信
初级用户
Credits 30
Posts 14
Joined 2010-10-06 00:30
15-year member
UID 175359
Gender Male
Status Offline
Just learned, for everyone's reference and study:

There are two usages of copy con.
1. Create a new file
copy con filename
After entering this command and pressing Enter, you enter the editing state. Enter the required content on the screen. After entering, press <Ctrl>+Z to end the editing, and the system automatically saves it.
This command can be used for simple text editing, but it can only create new files. If there is a file with the same name in the current specified path, it will be overwritten (if you want to edit the old file, please use EDIT).
2. Display file content (equivalent to TYPE)
copy filename con
Then the content of the specified file will be displayed on the screen.

In DOS, some devices appear in the form of special file names, such as CON (screen), PRN (printer), etc. They can be used in combination with COPY and other commands to complete many special tasks.
Forum Jump: