[command] [> | >>] [filename]
> saves the output of [command] into [filename].
>> appends the output of [command] into [filename].
echo Hello World > myfile.txtsaves "Hello World" into myfile.txt
echo your name is %name% >> myfile.txtappends "your name is xxxx" into myfile.txt
dir C:\ > directory.txtsaves the directory of C:\ to directory.txt
if you want to reproduce, please indicate the source:
batch-file – Creating Files using Batch – Redirection - CodeDay