Quote:
To use the FOR command in a batch program, specify %%variable instead of %variable.

Inside a batch file, %variable gets replaced by the contents of the environment variable "variable". However, %%variable gets replaced by the text "%variable" itself.