String interception function batch processing

Time:2021-1-11
Copy codeThe code is as follows:
::code by lxmxn @ cn-dos.net .
Objective: to help novices better understand variable character interception function
::Date 2006-12-16 .
Note: it is normal that the value of some variables is empty after interception
::
@echo off&setlocal EnableDelayedexpansion
: set the value of VaR:
set var=0123456789ABCDEF
call :begin
for /l %%a in (1,3,15) do (
for /l %%b in (1,4,15) do (
call :printf %%a %%b
)
)
call :begin
for /l %%a in (1,4,15) do (
for /l %%b in (-1,-3,-15) do (
call :printf %%a %%b
)
)
call :begin
for /l %%a in (-2,-3,-15) do (
for /l %%b in (1,4,15) do (
call :printf %%a %%b
)
)
call :begin
for /l %%a in (-1,-4,-15) do (
for /l %%b in (-2,-3,-15) do (
call :printf %%a %%b
)
)
pause
endlocal&cls&echo.
Echo demo is over. Press any key to exit
pause>nul
goto :eof

: output result:
:printf
Echo%% var: ~% 1,% 2%%, the character after interception is:! Var: ~% 1,% 2!
goto :eof

:: clean screen:
:begin
echo\&pause&cls&echo.
The value of echo variable VaR is% var%
echo.
goto :eof