Search code examples
filecmd

How can I create a .txt file on CMD?


Does someone knows how to create a file .txt on CMD?, I need like an order or steps to create it; I see that i need to write {echo "text"> "name".txt} but, i mean the content has not order and sometimes it doesn´t respond correctly.

Thank you guys Well, I know that I was not so clearly 'bout what I wanted to do, and I'm sorry, but, your advices also help me alot, so, Thank u.


Solution

  • Try creating a variable with the text first like as follows:

    set /p txt=Your Text Content; 
    echo %txt% > "Location\textfile.txt"
    

    EDIT: If you are meaning that the newline doesnt appear all you have to do is the following:

    echo "FirstLine" > "Location\textfile.txt"
    echo. "SecondLine" > "Location\textfile.txt"
    

    echo. instead of echo will start a new line.