简体   繁体   English

如何使用批处理脚本跨平台将文本追加到文件

[英]How to append text to file using batch-script cross-platform

How can we append "some text" to file.txt without the quotes, from a batch file? 我们如何从批处理文件中在没有引号的情况下将"some text"附加到file.txt Text files and only using what is "standard" on windows, linux and mac. 文本文件,仅使用Windows,Linux和Mac上的“标准”文件。

I did try: 我确实尝试过:

echo "some text" >> file.txt

it works for linux but on windows it does output the quotes to the file too; 它适用于linux,但在Windows上也将引号输出到文件;

but like mentioned we do need a cross-platform command (ie since we will use it in MakeFile of cross-platform project but that is another subject) 但是如前所述,我们确实需要一个跨平台命令(即,因为我们将在跨平台项目的MakeFile中使用它,但这是另一个主题)

You said echo "some text" >> file.txt worked but you also got the quotes. 您说echo "some text" >> file.txt但是您也得到了引号。 It was right you just have to remove the quotes then it will work ; 是的,您只需要删除引号即可使用; ). )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM