I got a new little problem
I try to parse this raw:
Code: Select all
@echo off
setlocal EnableDelayedExpansion
set string=a a;b b;c c;d d;e e;f f;g g;h h;;j;name.pdf
echo list = "%string%"
for /f "tokens=7,8,9,10 delims=;" %%a in ("!string!") do (
echo Variable 7=%%a
echo Variable 8=%%b
echo Variable 9=%%c
echo Variable 10=%%d
)
Results is:
list = "a a;b b;c c;d d;e e;f f;g g;h h;;j;name.pdf"
Variable 7=g g
Variable 8=h h
Variable 9=j
Variable 10=name.pdf
but when some value is missing "J" as show in this raw
set string=a a;b b;c c;d d;e e;f f;g g;h h;;;name.pdf
results is this
list = "a a;b b;c c;d d;e e;f f;g g;h h;;;name.pdf"
Variable 7=g g
Variable 8=h h
Variable 9=name.pdf
Variable 10=
I expect Variable 9 = nothing
I expect Variable 10 = name.pdf
How can I parse better this raw?
thank you in advance