简体   繁体   中英

Batch script to Replace CR by CRLF in in text file

I Want to create batch script to replace carriage return(CR) by CRLF (carriage return and Line Feed).It should be use for other text file also, I can replace that in notepad++ but want to replace for more than 1 file so need to create a separate batch file which on execution replace that CR by CRLF. Can anyone help me out in these situation.

Thank You

you can use notepad++ itself to mass replace

open a command prompt type notepad++.exe -noseesion -r .

this will open all the files in a directory only without any files from previous session

hit ctrl+h and replace in all documents

C:\massreplace>ls
001.bin                               001.txt  002.txt  004.txt
001.mysuperdupersecretsauceextension  001.yuk  003.txt  005.txt

C:\massreplace>"c:\Program Files\Notepad++\notepad++.exe" -nosession  -r *.*

C:\massreplace>

see in the screen shot below all the 8 files are open each files has 39 lines and 38 lines have CRLF i replaced all 38*8 = 304 CRLF with LF by hitting REPLACE all in all opened documents

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM