1.

Solve : For loop Skip=%var%?

Answer»

As the title depicts, in a for loop, I need skip to equal %var%. I tried for /f "skip=%var% delims=:" and for /f "delims=: skip=%var%" but it SAYS that it was unexpected at this time.Since you didn't post your code or say what OS you are using we can't see where your problem is

However, this works

Code: [Select]@ECHO off
echo 1:a>test.txt
echo 2:b>>test.txt
echo 3:c>>test.txt
echo 4:d>>test.txt
set var=2
for /f "tokens=1-2 skip=%var% delims=:" %%A in (test.txt) do (
echo %%A %%B
)
Code: [Select]3 c
4 dQuote from: Dias de verano on MAY 21, 2009, 01:00:49 PM

Since you didn't post your code or say what OS you are using we can't see where your problem is

However, this works

Code: [Select]@echo off
echo 1:a>test.txt
echo 2:b>>test.txt
echo 3:c>>test.txt
echo 4:d>>test.txt
set var=2
for /f "tokens=1-2 skip=%var% delims=:" %%A in (test.txt) do (
echo %%A %%B
)
Code: [Select]3 c
4 d
Strange...it didn't work for me the FIRST time.

Quote from: Dias de verano on May 21, 2009, 01:00:49 PM
say what OS you are using
It SHOWS that beside my post...


Discussion

No Comment Found