@echo off
if ""%1""=="""" goto useAge
if "%1"=="/?" goto useAge
if "%1"=="?" goto useAge
if "%1"=="/h" goto useAge
if "%1"=="/H" goto useAge
if ""%2""=="""" goto defaultFile
set fileName=%2
goto begin
:defaultFile
set fileName=index.html
:begin
if exist %fileName% goto existError
set tempFile=%temp%/~dir.txt
echo Creating file "%fileName%", please wait...
dir /b/s %1 >%tempFile%
echo ^<html^>^<head^>^<title^>index^</title^>^</head^>^<body οnlοad="window.focus();"^> >%fileName%
echo Create date: %date% %time%>>%fileName%
echo ^<br^>CMD path: >>%fileName%
cd >>%fileName%
echo ^<br^>Filter: %1>>%fileName%
echo ^<br^>Count: ^<b id="counter"^>^</b^> >>%fileName%
echo ^<div style="display:none"^> >>%fileName%
for /F "tokens=*" %%i in (%tempFile%) do @echo ^<span^>%%i^</span^> >>%fileName%
echo ^</div^> >>%fileName%
echo ^<script language="javascript"^> >>%fileName%
echo ^<!-- >>%fileName%
echo var objs=document.body.getElementsByTagName("SPAN");>>%fileName%
echo var fp=null;>>%fileName%
echo document.write("<table align='center' cellspacint='0' cellpadding='0' border='1' bordercolor='teal' bordercolordark='white'>");>>%fileName%
echo for(var i=0;i^<objs.length;i++){>>%fileName%
echo fp=objs[i].innerText;>>%fileName%
echo document.write("<tr bgcolor="+(i%%2==0?"FAFAF0":"F0FAFA")+"><td>"+(i+1)+"<td nowrap>"+fp.link(fp));>>%fileName%
echo }>>%fileName%
echo document.write("</table>");>>%fileName%
echo counter.innerText=objs.length;>>%fileName%
echo //--^> >>%fileName%
echo ^</script^> >>%fileName%
echo ^</body^>^</html^> >>%fileName%
del %tempFile%
echo Complete!
start %fileName%
goto end
:useAge
echo UseAge: %0 Filter [FileName]
echo Filter - match fileName
echo FileName - HTML file name
echo (end with .htm or .html, default with index.html)
echo Eexample:
echo %0 *.jpg picture.html
rem pause
goto end
:existError
echo File "%fileName%" has exist, create failed!
:end %fileName% has
rem ---------------------------------------------------------------------------
rem Script for create local-link-HTML_file
rem
rem $ zzf@2003-11-22 $
rem ---------------------------------------------------------------------------
@echo on
Filter - match fileName
FileName - HTML file name
(end with .htm or .html, default with index.html)
Eexample:
createIndex *.jpg picture.html
创建索引文件:(脚本略加了分行修改)
