bat脚本常用方法

1. for循环

@echo off

for /L %%a in (1,1,10) do (
    echo %%a
)

pause
goto :eof

:eof

2.函数调用

@echo off

set root=donothing/

call :print_info whatinfo

pause
goto :eof

:: functions
:: print_info start

:print_info
set _final=%~1
set _target=%root%%_final%

echo %_target%
goto :eof

:: print_info end

 

posted @ 2022-12-21 15:23  oredk  阅读(39)  评论(0)    收藏  举报