bat command to get all file names under the current file

echo off & color 0A
::指定起始文件夹, "%cd%"当前文件夹;%DIR%设置一个变量
set DIR="%cd%"
echo DIR=%DIR%
 
:: 参数 /R 表示需要遍历子文件夹,去掉表示不遍历子文件夹
:: %%f 是一个变量,类似于迭代器,但是这个变量只能由一个字母组成,前面带上%%
:: 括号中是通配符,可以指定后缀名,*.*表示所有文件
for /R %DIR% %%f in (*.txt) do ( 
echo %%f
)
输出当前目录所有文件夹名称
@echo off
for /d %%i in (*) do ( echo %%i )
pause
判断文件夹名称是否等于一个值
@echo off
for /d %%i in (*) do ( 
	echo %%i 
	if %%i==centosImages (
		pause
	)
	
)
pause
执行mvn命令
@echo off
for /d %%i in (*) do ( 
	cd %%i
	mvn clean
	cd ../
	pause
	
)

》》》Bloggers update their learning experience for a long time, recommend likes and follow! ! !
》》》If you have any questions or errors, please leave a message in the comment area, thank you! ! !

Guess you like

Origin blog.csdn.net/qq_41622739/article/details/106779348