how to remove CarriageReturn @end of each line '^M'

Category: visual studio editor


Bin Hex on Thu, 23 Aug 2012 16:37:51


By default windows uses \n\r for new line feed, But linux uses only \n... You can test it by opening the windows file in VIM using this command "vim -b filename"

I want to upload my file with out these \r characters @ the end...

Is there any way in VS to remove the carriage return character automatically?


Abhijit Annaldas on Fri, 24 Aug 2012 16:59:12


You can use find replace using regular expressions. Here is how it can be done:


Abhijit Annaldas

SDET, Microsoft India

The New Emperor on Mon, 27 Aug 2012 05:48:37

If you're doing it inside Visual Studio, you don't need a regex. Just use File->Save->Advanced Save Settings, set the line endings you want to use (Windows, in this case), and then save the file. It will do all the work for you. - Ken White