@echo off
rem 保存为bat文件跟txt文件放一起运行
md %~dp0\x\ 2>nul
for /f "delims=" %%a in ('dir /a-d/b *.txt') do (
setlocal EnableDelayedExpansion
(for /f "tokens=* delims=" %%b in ('type "%%a"') do (
set "str=%%b"
echo;!str: =,!
))>"%~dp0\x\%%~na.csv"
Endlocal
)