Batch change .txt to .csv

Please copy the following into the notepad, change the suffix to .bat

@echo off
setlocal enabledelayedexpansion

for %%F in (*.txt) do (
set /p .=Processing [%%~F] … <nul
set “firstline=”

(for /f “tokens=* usebackq” %%a in (“%%~nxF”) do (
if not defined firstline (
set firstline=%%a
echo !firstline:”=!
) else (
echo %%a

echo [%%~nF.CSV]
Picture2Place it in your folder, together with all other .txt file.
Double click .bat file, it will generate the .txt file the same name as the .csv file.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.