@echo off call :Sub %random% %random% %random% %random% pause goto :eof :Sub set "f=%*" if not defined f (echo 没有参数! & goto :eof) echo 过程名称: %0 echo 完整参数: %* echo -------------------------------------- echo 用for循环: set /a x=1 for %%i in (%*) do (call echo 第%%x%%个参数: %%~i & set /a x+=1) echo -------------------------------------- echo 用goto循环: set /a y=1 :loop set "t=%~1" if not defined t goto :eof echo 第%y%个参数: %~1 set /a y+=1 shift goto loop