SoFunction
Updated on 2025-04-10

How to apply batch variables

Detailed help reference: set /?   cmd/?   Be sure to read carefully!

Specific application:

1. Get variable sub-string: echo %date:~0,4%%date:~5,2%%date:~-2,2%%time:~0,2%%time:~3,2%%time:~6,2%%
2. Variable content replacement: set str=000111000 && echo %str:000=222%    &&  echo %date:-=%%time::=%
3. Delay variable environment extension: cmd/v:on
               set /a j=0
               for /l %i in (1,1,10) do set /a j=!j!+%i