[英]Why the 1st parameter in the Call statement is not surrounded with % sign? (Batch File)
當call語句中的第一個參數沒有用'%'符號包圍時,該批處理文件仍如何工作?
@echo off
set "fst=0"
set "fib=1"
set "limit=1000000000"
致電:myFibo fib,%fst%,%limit%
echo.The next Fibonacci number greater or equal %limit% is %fib%.
echo.&pause&goto:eof
::--------------------------------------------------------
::-- Function section starts below here
::--------------------------------------------------------
:myFibo -- calculate recursively the next Fibonacci number greater or equal to a limit
:: -- %~1: return variable reference and current Fibonacci number
:: -- %~2: previous value
:: -- %~3: limit
SETLOCAL
set /a "Number1=%~1"
set /a "Number2=%~2"
set /a "Limit=%~3"
set /a "NumberN=Number1 + Number2"
如果/ i%NumberN%LSS%Limit% call:myFibo NumberN,%Number1%,%Limit%
(ENDLOCAL
IF "%~1" NEQ "" SET "%~1=%NumberN%"
)
goto:eof
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.