@echo off 先关闭其他盘符
算术运算 set /a 1+2
变量:set /a var = 10 * (2 + 9)
echo %var%
set a=hello
rem 分支语句
if exist c:aa\123.txt (
echo ok
) else (
echo no
)
rem 循环遍历目录
for /d %%a in (*) do echo %%a==test rd %%a
rem 循环遍历文件
for /r "c:\ww\qq" %%v in (*.py) do del %%v
rem 循环遍历数字
for /L %%v in (1,1,20) do ping %1.%%v
rem 循环遍历文件内容
for /F %%v in (3.bat) do echo %%v
:loop
md VVV
cd VVV
goto loop
rem 标准输入
:first
set /p opt=
if %opt% == 1 goto first
pause>nul
exit
&&(and) ||(or)
网友评论