Windows command to convert Unix line endings?
This can actually be done very easily using the more
command which is included in Windows NT and later. To convert input_filename
which contains UNIX EOL (End Of Line) \n
to output_filename
which contains Windows EOL \r\n
, just do this:
TYPE input_filename | MORE /P > output_filename
The more
command has additional formatting options that you may not be aware of. Run more/?
to learn what else more
can do.
I was dealing with CRLF
issues so I decided to build really simple tool for conversion (in NodeJS):
So if you have NodeJS with npm installed you can try it:
npm i -g eol-converter-clieolConverter crlf "**/*.{txt,js,java,etc}"
Path might be configured dynamically by using Glob regex (same regex as in shell).
So if you can use NodeJS, it's really simple and you can integrate this command to convert whole workspace to desired line endings.