For example, I have this string in another variable:
444455556666&X=697&Y=250
I want to get the number after "&X=" in a variable and the number after "&Y=" in another variable. Is it possible in batch file? Notice: the number 444455556666 is VARIABLE (it can be it can be shorter or longer, so i can't split with the position)
You have a fine format there: If you split it by &
, you get a number, X=nnn
, and Y=nnn
. Skip the first and use the second and third:
set "var=444455556666&X=697&Y=250"
for /f "tokens=2,3 delims=&" %%x in ("%var%") do set "%%x"&set "%%y"
echo %x%,%y%