I'm trying to strip spaces and commas from %%~ni
. I've managed to do it by putting it into my new variable !url!
. It echos fine, but does anyone know why I can't use it here: set "line=!line:REPLACE=!url!!"
?
@echo off
setlocal enableextensions enabledelayedexpansion
for /R %%i in (*.csv) do (
ren "%%~i" temp.tmp
(for /F "usebackq tokens=*" %%f in ("%%~dpitemp.tmp") do (
set "line=%%f"
echo %%~ni
set url=%%~ni
set url=!url: =-!
set url=!url:,=!
echo !url!
set "line=!line:REPLACE=!url!!"
echo(!line!
)) > "%%~i"
del "%%~dpitemp.tmp"
)