使用bat批处理txt文件内容到execl中

来源:互联网 发布:端口类型以太网 编辑:程序博客网 时间:2024/05/17 07:06
@echo off
call :txt2csv "1.txt" >1.csv
exit /b


:txt2csv <InputFile>
        SetLocal EnableDelayedExpansion
        
        for /f "usebackq tokens=*" %%i in ("%~1") do (
                set str_full=%%i
                for /f "tokens=1,2,3,4 delims=, " %%a in ("%%i") do (
                        echo %%~nxa,!str_full:*%%a=!
                )
        )
        
        EndLocal

goto :eof




参考:http://www.bathome.net/thread-26101-1-1.html

0 0