I tried both the below scripts, but i can see the new blank output file generated with no records. Can someone help with me with the working code as i am new to windows scripting.
@echo off
setlocal enabledelayedexpansion
set inputCSV=%1
set outputCSV=%2
(for /f "tokens=*" %%a IN (%inputCSV%) DO (
set column=0
set "line="
for %%i in ( %%a ) do (
set /a column+=1
set value=%%~i
if !column!==4 (
if "!value!"=="" set "value=0"
)
set "line=!line!,"!value!""
)
echo !line:~1!
))>%outputCSV%
@echo off
setlocal enabledelayedexpansion
set inputCSV=%1
set outputCSV=%2
(for /f "tokens=1-4,* delims=," %%a IN (%inputCSV%) DO (
if "%%d"=="""" (set "value="000"") else (set "value=%%d")
echo %%a,%%b,%%c,!value!,%%e
))>%output.csv