To convert string of words into an array in batch script, I wrote a small script
setlocal enableextensions enabledelayedexpansion
echo run
set sentence=a~b~c
set /a i=0
for /f "tokens=1,2,3 delims=~" %%a in ("%sentence%") do (
set /a i+=1
set array[!i!]=%%a
)
echo %array[1]%
echo %array[2]%
But there is some problem with this logic as only first element gets assigned. How can i correct this.