How to remove ^M at the end of every line

Hi, today i just gone through a serious problem between windows and unix.

Problem description:

Whenever i move file from windows to UNIX with winscp. Every line got ^M at the end in every file.

Solution:

I opened that file in vi and done this

:%s/^M//g 
 Where ^ is (Control V) and M is (Control M).
It will remove all the trailing ^M at the end of every line.