How can I use a batch file to write to a text file?

后端 未结 7 1741
不知归路
不知归路 2020-12-07 07:58

I need to make a script that can write one line of text to a text file in the same directory as the batch file.

7条回答
  •  [愿得一人]
    2020-12-07 08:45

    echo "blahblah"> txt.txt will erase the txt and put blahblah in it's place

    echo "blahblah">> txt.txt will write blahblah on a new line in the txt

    I think that both will create a new txt if none exists (I know that the first one does)

    Where "txt.txt" is written above, a file path can be inserted if wanted. e.g. C:\Users\\desktop, which will put it on their desktop.

提交回复
热议问题