I am trying to make the contents of a text file look nice, and the requirement is that the first line is NOT necessarily indented, but the following lines should be indented with three spaces.
How can I realize this function? Thank you.
how to indent the outputs in dos batch file
Moderator: DosItHelp
It's easy when the source of the indended content is another file.
I.e.:
If names.txt containes names like:
Then code like this ...
... will create an output like this ...
DOS IT HELP?
I.e.:
If names.txt containes names like:
Code: Select all
Daniel
Ollie
Sam
Nina
Victor
Cris
Then code like this ...
Code: Select all
echo.List of Names:>list.txt
for /f "tokens=* delims=" %%a in (names.txt) do echo. %%a>>list.txt
... will create an output like this ...
Code: Select all
List of Names:
Daniel
Ollie
Sam
Nina
Victor
Cris
DOS IT HELP?