This is a quick tutorial to explain how to convert LF line break to CR LF line endings. There is a free Command line tool, known as Swiss File Knife which takes a file which has LF line endings and then it converts those LFs to CRLF. Just a single command of Swiss File Knife can convert LF to CRLF. And there is an option to specify the target file extensions whose line break you want to convert in bulk.
This command line software comes with tons of utilities to perform various tasks. And on of the features of Swiss File Knife is that it can convert LF line break to CRLF endings. This is useful in many cases especially when you are dealing with programming languages files such as CPP, FRM, VB, C, or any other. LF and CR line endings are by default used by Linux and MAC. And Windows uses CR LF to indicate line endings. You can read about difference between LF, CR, and CRLF line feeds here.
So, now let’s see what it takes to convert LF line endings to CRLF line endings in Windows.
How to Convert LF Line Endings to CRLF Line Endings?
Swiss File Knife is a very good command line software to convert LF line endings to CRLF line endings. It takes a bunch of file names or extensions to convert the LF line endings. And by just a running the single command, you can easily do that. Swiss File Knife comes as a portable software, so you can start using it right after you have downloaded it.
Step 1: Download portable EXE of Swiss File Knife from here. After that, copy-paste the downloaded EXE to C:\Windows folder. Now, the commands of Swiss File Knife will work from any directory of your PC.
Step 2: Now open the folder which has the files whose line endings you want to convert. Open Command prompt in the same folder and run the following command.
sfk addcr "Filename"
After running the above command, all the LF line endings in the source file will be converted to CRLF. The converted files are now in Windows file’s standard.
In the tutorial above, I have demonstrated how to convert LF endings to CRLF line endings. And Swiss File Knife is the tool that can do that in just a few seconds. I really like the fact that it can process multiple files together and supports large number of other operation as well. So, if you are looking for a free software to do the same, then this tutorial will be a great help to you.