Thanks a lot for sharing, Windows shell still has a lot of surprising features yet to discover ! I was aware of the DOS variable limitation at run-time but didn't know - until your post - how to work around it. :-) My favorite shell reference website explains this with more details : see https://ss64.com/nt/delayedexpansion.html .