Jawaban Anda untuk menggunakan dos2unix dan unix2dos sangat bagus.
Inilah cara lain berdasarkan jawaban Anda.
Anda dapat menggunakan Gnuwin32 meskipun cukup lucu paket Gnuwin32 yang memiliki perintah adalah Cygutils http://gnuwin32.sourceforge.net/packages/cygutils.htm demikian maka Anda akan mendapatkan unix2dos.exe dan dos2unix.exe di C: \ Program Files .... \ GnuWin32 \ bin dan dengan itu di PATH Anda.
C:\somedir>dir<ENTER>
Volume in drive C has no label.
Volume Serial Number is DC46-3C68
Directory of C:\somedir
05/23/2014 01:10 AM <DIR> .
05/23/2014 01:10 AM <DIR> ..
05/23/2014 01:10 AM 4 file1
1 File(s) 4 bytes
3 Dir(s) 196,129,951,744 bytes free
Do this command to go from dos2unix
C:\somedir>for %f in (*) do dos2unix %f <ENTER>
C:\somedir>dos2unix file1 <-- This runs automatically from you doing the above command
file1: done.
And do this command to go from unix2dos
C:\somedir>for %f in (*) do unix2dos %f <ENTER>
C:\somedir>unix2dos file1 <-- This runs automatically from you doing the above command
file1: done.
C:\somedir>
Dan untuk menguji apakah Anda untuk% f akan melakukan apa yang Anda inginkan, maka gunakan gema atau @ECHO misalnya
untuk% f di (*) lakukan @ECHO unix2dos% f
Dan Anda dapat menggunakan xxd untuk membuat file dan menguji mereka dikonversi. xxd untuk windows dilengkapi dengan VIM C: \ Program "" File \ vim \ vim74 \ xxd.exe
so, i'll create a file, I like this style of command is it allows me to
create whateer file I want, a dos one or a unix one or anything.
61 is hex for 'a'
C:\somedir>echo 610d0a| xxd -r -p >testfile <ENTER>
check the file raw, in its hex
C:\somedir>cat testfile | xxd -p <ENTER>
610d0a
check the file in ascii or unicode
C:\somedir>cat testfile <ENTER>
a
and the following commands just prove that dos2unix and unix2dos work/are working fine.
C:\somedir>dos2unix testfile <ENTER>
testfile: done.
C:\somedir>cat testfile | xxd -p <ENTER>
610a
C:\somedir>unix2dos testfile <ENTER>
testfile: done.
C:\somedir>cat testfile | xxd -p <ENTER>
610d0a
C:\somedir>
perhatikan-juga dalam kasus menggunakan distro * nix, melihat apt-get (apt-cache search dos2unix) paketnya memang (mungkin tidak mengejutkan!) dos2unix (jadi diinstal dengan apt-get install dos2unix) dan itu termasuk bersama dengan dos2unix executable, unix2dos dapat dieksekusi. Jika Anda melakukan pencarian apt-cache unix2dos itu menunjukkan paket dos2unix.