1.

Solve : for %v in was unexpected at this time?

Answer»

Code: [Select]cls
@echo off
if [%1]==[] %0 20 18
if [%2]==[] %0 %1 18
set {t}=fb800:0l1f40 b0 71
:loop
if not [%4]==[] for %%v in ( set shift shift goto:loop) do %%v {t}=%{t}% %3 %4
> {s} echo %{t}%
>>{s} for %%v in (echo.q set) do %%v {t}=
< {s} debug > nul
del {s}
I am getting error of:

for %v in was unexpected at this time.

C:\>


And not sure why. This is an old batch from 10 years ago that use to work under Win 95 or 98 SE, but pukes on Win XP Pro. Error seems to be this section of code...but not sure how to fix it... It all looks CORRECT.
Please describe what the batch is supposed to do. The DOS/Win98 version of FOR is quite a bit different from the NT family version found in Windows 2000 and later.
From memory since I dont have an older system to run this on. It use to show a GREY background with blue text to be displayed and might have beeped the PC speaker, although I dont see a Beep command here.

Background and text colors can be solved by color xx command. I COULD essentially drop the code above and add COLOR 81 and get the same display appearance that I remember, but was curious WITHOUT butchering the batch if anyone knew why.

Your statement of Quote

The DOS/Win98 version of FOR is quite a bit different from the NT family version found in Windows 2000 and later.
is probably the REASON why. I guess I should perform a google seach maybe to see the differences and why for the change between pre-NT and NT FOR statement parameters, since that is what it appears to be now.

Thanks for pointing that out!.


Discussion

No Comment Found