I'm trying to convert all backslashes () to forward slashes (/) in a variable which contains a file name and location. I've read about this and seen:
%variable:str1=str2%
and
set "var=%var:\=/%"
which I've attempted, but I'm obviously not getting it right.
Here is the relevant section of my .bat script:
FOR %%f IN ("E:\myfiles\app1\data\*.csv") DO (
echo %%f
set "f=%%f:\=/%"
echo %%f
echo.
)
The output show each filename listed twice.
i.e. this line:
set "f=f:\=/%"
is not doing what I want it to. Can anyone see what I am doing wrong?
This will change the back-slashes to forward-slashes in a variable:
set "variable=E:\myfiles\app1\data\*.csv"
set "variable=%variable:\=/%"
echo "%variable%"