- @echo off & setlocal enableDelayedExpansion
- set testStr=asdfghjk987654
- set testStr
- call :printReverse testStr & echo.
- call :printDev testStr 0 & (echo )
- pause
- exit /b
-
- :printReverse
- setlocal
- if "!%1!" leq "" exit /b
- set tt=!%1!
- set /p=!tt:~-1!<nul
- set tt=!tt:~,-1!
- call :printReverse tt
- exit /b
-
- :printDev str pt
- setlocal
- if "!%1:~%2,1!" leq "" exit /b
- set /p=!%1:~%2,1!,<nul
- set /a tt=%2+1
- call :printDev %1 !tt!
- exit /b
复制代码
|