新行添加到MS-DOS的文本文件 [英] Add a new line to a text file in MS-DOS
问题描述
我想提出一个的.bat
文件,我想它写的 ASCII艺术到一个文本文件中。
我能找到的命令回显文本时附加新行添加到文件,但是当我读到的文本文件,我看到的是一个布局的标志,而不是一个空格。我认为这将打开与Word甚至写字板该文件的工作,但我想它在任何计算机上工作,即使计算机只有记事本(其中大部分是这种情况)。
我怎么能在一定程序中打开文本文件(即写字板),或者写一个适当的空格字符的文件?
编辑:
我发现它是用最好的方式:
回声<一号线> > <&名GT;
回声< 2号线> >> <&名GT;
P.S。我用 |
我的ASCII艺术,所以它坠毁,哑喑哑:)
回声你好,> file.txt的
回声。 >> file.txt的
回声世界>> file.txt的
和你总是可以运行:
file.txt的写字板
在Windows的任何版本。
在Windows 2000及以上你可以这样做:
(回声您好,&安培;回声和放大器;回声世界)GT; file.txt的
表示文本的少量消息的另一种方法是创建包含file.vbs:
MSGBOX你好,&放大器; vbCrLf&安培; vbCrLf&安培; 世界,0,消息
与调用它
CSCRIPT / NOLOGO file.vbs
或者使用 W脚本
,如果你不需要它等待,直到他们单击确定。
与你写邮件的问题是,竖线( |
)是的管道运营商。你需要使用逃脱它 ^ |
而不是 |
的 P.S。它的拼写 PWNED 的
I am making a .bat
file, and I would like it to write ASCII art into a text file.
I was able to find the command to append a new line to the file when echoing text, but when I read that text file, all I see is a layout-sign and not a space. I think it would work by opening that file with Word or even WordPad, but I would like it to work on any computer, even if that computer only has Notepad (which is mostly the case).
How can I open the text file in a certain program (i.e. WordPad) or write a proper space character to the file?
EDIT:
I found that it is the best way to use:
echo <line1> > <filename>
echo <line2> >> <filename>
P.S. I used |
in my ASCII art, so it crashed, Dumb Dumb Dumb :)
echo Hello, > file.txt
echo. >>file.txt
echo world >>file.txt
and you can always run:
wordpad file.txt
on any version of Windows.
On Windows 2000 and above you can do:
( echo Hello, & echo. & echo world ) > file.txt
Another way of showing a message for a small amount of text is to create file.vbs containing:
Msgbox "Hello," & vbCrLf & vbCrLf & "world", 0, "Message"
Call it with
cscript /nologo file.vbs
Or use wscript
if you don't need it to wait until they click OK.
The problem with the message you're writing is that the vertical bar (|
) is the "pipe" operator. You'll need to escape it by using ^|
instead of |
.
P.S. it's spelled Pwned.
这篇关于新行添加到MS-DOS的文本文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!