toyerspollors 当前离线
一级士官
set 1=*.mp3 set 2=*.mp4 set 3=*.mov set 4=*.pdf set 5=*.html set /p 文件类型=若要选择多种格式请使用空格隔开,如(1 2 3): for /f "delims=" %%i in ('dir /b /a-d %文件类型%') do ( ::下方的忽略复制代码
idwma 当前离线
少校
TOP
qixiaobin0715 当前在线
大校
回复 toyerspollors 批处理变量名命名规则: 1.不能含有等号 2.最好不要以数字开头,容易与参数变量混 ... qixiaobin0715 发表于 2021-7-7 15:17
@echo off setlocal enabledelayedexpansion set a=*.mp3 set b=*.mp4 set c=*.mov set d=*.pdf set e=*.html set /p var1= for %%a in (%var1%) do set var2=!%%a! !var2! for /f "delims=" %%i in ('dir /b /a-d %var2%') do ( ....复制代码
@echo off setlocal enabledelayedexpansion set a1=*.mp3 set a2=*.mp4 set a3=*.mov set a4=*.pdf set a5=*.html set /p var1= for %%a in (%var1%) do set var2=!a%%a! !var2! echo,%var2% pause复制代码