中国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-09-15 12:31
47,812 topics / 349,917 posts / today 0 new / 48,268 members
DOS学习入门 & 精彩文章 (教学室) » Ask the great experts, how many ways are there to generate text files (*.txt) using DOS commands?
Printable Version  7,935 / 16
Floor1 sexgirl Posted 2005-08-03 22:00
新手上路 Posts 4 Credits 6
Ask the great experts, how many ways are there to generate text files (*.txt) using DOS commands?
Floor2 willsort Posted 2005-08-03 22:11
元老会员 Posts 1,512 Credits 4,432
Re sexgirl:

Please tell us the original intention or goal for which you need this knowledge, what the restrictions are, and other background information you think should be stated. Otherwise, it will be difficult for you to get the answer you want.
Floor3 sexgirl Posted 2005-08-03 22:32
新手上路 Posts 4 Credits 6
In the computer professional title examination questions, there is a question: "In the MS-DOS mode of Windows 98, generate a file from the keyboard. The content of the file is 'I`m a teacher', the file name is LX.TXT, and save it to drive A."
c:\1.jpg
Floor4 willsort Posted 2005-08-03 22:39
元老会员 Posts 1,512 Credits 4,432
Re sexgirl:

  Then you can use the following sentence pattern (using the echo command and the redirection output symbol ">"):

  echo I'm a teacher>A:\LX.TXT

  Or use this sentence pattern (using the copy command and the console device con):

  copy con A:\LX.txt
I'm a teacher(Press Ctrl+Z here, excluding the parentheses)
Floor5 sexgirl Posted 2005-08-03 22:53
新手上路 Posts 4 Credits 6
Grate不尽, the second method is the correct answer, I also want to figure out the specific meaning represented by Ctrl+Z
Floor6 Michael Posted 2005-08-03 22:58
钻石会员 Posts 3,041 Credits 10,056
Ctrl +Z indicates the end of the file. Pressing F6 can also do it. Check it with a hex editor.
Floor7 sexgirl Posted 2005-08-03 23:03
新手上路 Posts 4 Credits 6
Thank you very much. I just learned today that DOS is so profound. Once again, I show my respect to the expert!
Floor8 JonePeng Posted 2005-08-03 23:35
金牌会员 Posts 1,883 Credits 4,562 From 广东广州
I clearly remember that this question was discussed last year, and that computer exam question was exactly the same.
Floor9 willsort Posted 2005-08-06 20:42
元老会员 Posts 1,512 Credits 4,432
Re sexgirl:

For your question, I really can't figure out why echo + redirection is not the correct answer? Unless it requires that there are no carriage returns and line feeds in the file, but it doesn't have such a restriction.

For this question, in fact, there are more methods, such as:

type con > a:\lx.txt
I'm a teacher (press Ctrl+Z here, excluding the parentheses)

Or:

debug a:\lx.txt
e 100 "I'm a teacher"
r cx
d
w
q

There is also the edlin solution, and it doesn't limit the use of third-party tools, so there are countless optional answers. In fact, since I have a little understanding of DOS, I have found that the so-called "standard answers" in many computer DOS test questions have historical limitations and application limitations.
Floor10 JonePeng Posted 2005-08-06 21:59
金牌会员 Posts 1,883 Credits 4,562 From 广东广州
Re: re-sort:

Hehe, the so-called "correct answer" is actually just the reference answer from that computer textbook. There's no need to get overly nitpicky. Nowadays, many computer certification exam textbooks (level one or two) have relatively simple questions related to DOS, so the answers aren't too profound. The method of using copy con is a very common practice, which is easy for computer beginners to accept. I actually think the method of using echo redirection belongs to the field of batch processing programming. Computer level one, two, etc. exams usually don't involve the application of batch processing, and the method of using debug is rarely used even by experts.

[ Last edited by JonePeng on 2005-8-6 at 22:00 ]
Floor11 willsort Posted 2005-08-08 11:52
元老会员 Posts 1,512 Credits 4,432
Re JonePeng:

  What I mean is that we can break out of the constraints of exam questions, use divergent thinking, and make the topic "How many ways are there to generate text files with DOS commands" by the original poster more worthy of its name.

  Regarding copy con, it may not be more common than type con >. As for whether it is easy to accept, it also depends on the degree of acceptance and how many people can know both the reason and the result. For example, what does con mean? What does it represent? Why is it not a file but can be copied? Why does Ctrl+Z represent the end of a file?

  Regarding echo, in fact, I use it in the command line much more frequently than copy con, because its input volume is smaller. And debug is also often used in some fields. Because they each have their own advantages and disadvantages, studying them better can prevent us from being at a loss when we need them.

  In fact, there are quite a lot of methods to generate text files. I will give the scheme of pipeline commands again:


.....
Floor12 JonePeng Posted 2005-08-08 14:35
金牌会员 Posts 1,883 Credits 4,562 From 广东广州
Really didn't expect there are so many ways! Great!!!
Floor13 hbhhwy Posted 2009-06-21 03:27
新手上路 Posts 6 Credits 8 From 深圳市
Learning hard! When will I reach your level?
Floor14 crocodile Posted 2009-06-21 07:08
初级用户 Posts 12 Credits 25
To be honest, I use ">" more than anything else. echo is indeed very commonly used. However, copy con... is only used in some programming, and the frequency is far lower than that of echo & >. These damn computer exam questions should be more accurate. Don't not understand whether it's right or wrong, and just use a single answer to evaluate.
Floor15 pjdjq002 Posted 2009-06-21 08:24
新手上路 Posts 6 Credits 10
So many methods originally,!!!
1 2  Next
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023