However, it shows a new effect.
I discovered this too and already applied the technique:
My contribution, a function definitions list
http://www.dostips.com/forum/viewtopic.php?f=3&t=1893
Moderator: DosItHelp
However, it shows a new effect.
Yes - I was a bit shocked when %%s impacted :toLower. I thought I remembered doing an experiment that showed loss of access to FOR variables after a call, but it wasn't quite crystallizing in my mind. Your simple test code makes the behavior very clear.jeb wrote:However, it shows a new effect.Now you can see, even in a sub function you could access for-loop vars from outside,Code: Select all
@echo off
setlocal EnableDelayedExpansion
for %%s in ("s-content") do (
echo loop1 loopvar-s=%%s
call :test
)
exit /b
:test
echo test1 loopvar-s=%%s
for %%a in ("a-content") do (
echo loop2 loopvar-a=%%a
echo loop2 loopvar-s=%%s
)
exit /b
if you start your own local for-loop.
I'm assuming the slowness is inherent to the CALL statement. I'm aware a CALL to a label slows down as the size of the file increases. But I am surprised that a call without a label is so slow. Can you shed any light on the mechanism behind the scenes that is making CALL so slow. I am also seeing a high degree of variability between machines.jeb wrote:the main problem in the "old" implementation is theIt is very slowCode: Select all
call set %~1=%%%~1:%%~a%%