遍历生成文件夹html图片

创建时间:2018/4/24 10:30
来源:http://www.360doc.com/content/15/0205/20/21861372_446525665.shtml

:以百度贴吧形式(套图形式)浏览当前文件夹中的图片
@echo off&SetLocal EnableDelayedExpansion
For /f "delims=" %%i in ('dir/b/on') do (Set a=%%~pi
Set a=!a:\= !)
For %%i in (%a%) do Set b=%%i
::获取文件夹名
Set n=0
(
Echo ^<Html^>
Echo ^<Title^>
Echo %b%
Echo ^</Title^>
Echo ^<Body^>
For /r %%i in (*.jpg *.bmp *.gif *.png) do (Echo ^<Img Src="%%i"^>
Set n=1)
::将当前文件夹中所有的图片地址写入到html文件中。
Echo ^</Body^>
Echo ^</Html^>
)>"%b%.html"
If %n%==0 Msg * "当前文件夹中没有图片" & del %b%.html
If %n%==1 Start "" "%b%.html"