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

您所在的位置:网站首页 怎么把压缩包rar改成zip格式文件 文件从 UNIX(LF) 批量改为 PC(CR+LF) ,编码格式保持源文件编码,CMD转换成功

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

2023-06-27 03:15| 来源: 网络整理| 查看: 265

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

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

--注意说明 windows电脑上 打开cmd,直接执行命令  --会显示输出文件乱码,这里忽略,只是编译过程

chcp 936   --源文件编码是 GBK chcp 65001 --源文件编码是 UTF-8 D:\opt\output\DATA_FILE\20230531  --源文件路径  D:\opt\output\DATA_FILE\20230531\output --新文件输出路径

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

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

 

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

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

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

--注意说明 windows电脑上 打开cmd,直接执行命令  --会显示输出文件乱码,这里忽略,只是编译过程

chcp 936   --源文件编码是 GBK chcp 65001 --源文件编码是 UTF-8 D:\opt\output\DATA_FILE\20230531  --源文件路径  D:\opt\output\DATA_FILE\20230531\output --新文件输出路径

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

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

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

 

 



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3