700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > 文件从 UNIX(LF) 批量改为 PC(CR+LF) 编码格式保持源文件编码 CMD转换成功

文件从 UNIX(LF) 批量改为 PC(CR+LF) 编码格式保持源文件编码 CMD转换成功

时间:2021-08-03 04:02:08

相关推荐

文件从 UNIX(LF) 批量改为 PC(CR+LF)  编码格式保持源文件编码 CMD转换成功

如何把文件从 UNIX(LF) 批量改为 PC(CR+LF) ,编码格式保持源文件编码,通过电脑自带cmd 批量更改-1.0

chcp 65001 && FOR /F "tokens=*" %f IN ('dir /b D:\opt\output\DATA_FILE\0531\*.DAT') DO type "D:\opt\output\DATA_FILE\0531\%f" | more /p > "D:\opt\output\DATA_FILE\0531\output\%f.tmp" & TYPE "D:\opt\output\DATA_FILE\0531\output\%f.tmp" && MOVE /Y "D:\opt\output\DATA_FILE\0531\output\%f.tmp" "D:\opt\output\DATA_FILE\0531\output\%f"chcp 65001 && FOR /F "tokens=*" %f IN ('dir /b D:\opt\output\DATA_FILE\0531\*.DAT') DO type "D:\opt\output\DATA_FILE\0531\%f" | more /p > "D:\opt\output\DATA_FILE\0531\output\%f.tmp" & TYPE "D:\opt\output\DATA_FILE\0531\output\%f.tmp" && MOVE /Y "D:\opt\output\DATA_FILE\0531\output\%f.tmp" "D:\opt\output\DATA_FILE\0531\output\%f"

--注意说明

windows电脑上 打开cmd,直接执行命令

--会显示输出文件乱码,这里忽略,只是编译过程

chcp 936 --源文件编码是 GBK

chcp 65001 --源文件编码是 UTF-8

D:\opt\output\DATA_FILE\0531 --源文件路径

D:\opt\output\DATA_FILE\0531\output --新文件输出路径

1. 找到要转换的源文件路径,创建新文件输出的路经

--D:\opt\output\DATA_FILE\0531 --源文件路径

2. 复制代码,根据自己的实际路径修改代码 注意说明,根据自己的 实际情况修改,改代码只用于

UNIX(LF) 批量改为 PC(CR+LF)

chcp 65001 && FOR /F "tokens=*" %f IN ('dir /b D:\opt\output\DATA_FILE\0531\*.DAT') DO type "D:\opt\output\DATA_FILE\0531\%f" | more /p > "D:\opt\output\DATA_FILE\0531\output\%f.tmp" & TYPE "D:\opt\output\DATA_FILE\0531\output\%f.tmp" && MOVE /Y "D:\opt\output\DATA_FILE\0531\output\%f.tmp" "D:\opt\output\DATA_FILE\0531\output\%f"chcp 65001 && FOR /F "tokens=*" %f IN ('dir /b D:\opt\output\DATA_FILE\0531\*.DAT') DO type "D:\opt\output\DATA_FILE\0531\%f" | more /p > "D:\opt\output\DATA_FILE\0531\output\%f.tmp" & TYPE "D:\opt\output\DATA_FILE\0531\output\%f.tmp" && MOVE /Y "D:\opt\output\DATA_FILE\0531\output\%f.tmp" "D:\opt\output\DATA_FILE\0531\output\%f"

--注意说明

windows电脑上 打开cmd,直接执行命令

--会显示输出文件乱码,这里忽略,只是编译过程

chcp 936 --源文件编码是 GBK

chcp 65001 --源文件编码是 UTF-8

D:\opt\output\DATA_FILE\0531 --源文件路径

D:\opt\output\DATA_FILE\0531\output --新文件输出路径

--打开cmd ,直接执行命令,等待命令执行完成

3.输出文件的结果 ,在新文件输出路径下查看

--D:\opt\output\DATA_FILE\0531\output --新文件输出路径

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。