cmd create text file code example

Example 1: write file using command windows

echo some-text  > filename.txt

Example 2: make new file windows cmd

type nul > README.txt

Example 3: create a file cmd

type NUL > EmptyFile.txt
# also
echo. 2>EmptyFile.txt
copy nul file.txt > nul # also in qid's answer below
REM. > empty.file
fsutil file createnew file.cmd 0 # to create a file on a mapped drive

Example 4: make text file command line

cat > sample.txt
# Write some text, press Ctrl+D when you are done

Example 5: creating text file in cmd

echo. > location with name

Tags:

Misc Example