I would like to process and rewrite parameters passed to a windows bat file and then call another bat file. More precisely: I want to replace backslashes in parameters by slashes.
Example:
first.bat C:\Users\myself\test.txt anotherParam
should call
second.bat C:/Users/myself/test.txt anotherParam
My attempt so far:
@echo off
setlocal ENABLEDELAYEDEXPANSION
set argCount=0
for %%x in (%*) do (
set /A argCount+=1
call set argVec[!argCount!]=%%~x:\=/%%
)
echo Number of processed arguments: %argCount%
for /L %%i in (1,1,%argCount%) do echo %%i- "!argVec[%%i]!"
call second.bat %argVec%
Problems:
- String replacement in loop does not work as expected
- Call of second.bat does not submit parameters
Thank you for suggestions on this topic.