I was trying to catch errors from overflowing variables (is it possible, btw?) when I noticed the following:
Code: Select all
@echo off & setlocal enableextensions disabledelayedexpansion
:: create variable containing 4k hashes
set "hashFile=%tmp%\hashFile.tmp"
if not exist "%hashFile%" (
<nul set /p "=#" >"%hashFile%"
for /l %%I in (1 1 12) do type "%hashFile%" >>"%hashFile%"
)
for /f "usebackq delims=" %%A in ("%hashFile%") do set "hashStr=%%A"
:: next line parses ok
:: %hashStr:#=$%
echo(works ok
:: next line throws 2 errors
:: %hashStr:#=$$%
echo(never reached
endlocal & goto :EOF
It seems there is some form of variable expansion going on inside :: comments after all!
- SB