F100d
F100d

Reputation: 73

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.

Upvotes: 7

Views: 29645

Answers (4)

Vicky Gupta
Vicky Gupta

Reputation: 636

If you want to create a binary file: C:\>type nul > Diff1.vhd

Upvotes: 0

notfeuerwerko
notfeuerwerko

Reputation: 11

echo your_text_here > filename.extension

Upvotes: 1

Willie Cheng
Willie Cheng

Reputation: 8253

Easy way to do this

echo "abcdef" > a.txt
echo "12345" >> a.txt

the a.txt content will be

"abcdef"
"12345"

Upvotes: 5

Ethan Gallant
Ethan Gallant

Reputation: 328

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.

Upvotes: 3

Related Questions