标题: [原创]本地音乐文件搜索
[打印本页]
作者: freeants001
时间: 2008-11-12 09:54
标题: [原创]本地音乐文件搜索
::=====================================================
:: code by freeants CMD@XP 15:03 2007-6-7 version:1.00
::=====================================================
@echo off
ver|find "Windows XP" >nul && goto xp
echo ================================
echo 该脚本在Windows XP SP2上测试成功
echo 为防止在其它的系统中运行发生不可
echo 预料的错误,请在XP下运行……
echo ================================
pause
cls & echo 创建HTML文件中,请稍后……
goto eol
:xp
::echo ================================================================================
::echo 功能:将搜索本地磁盘中的音乐文件,并在当前目录下创建一个名为
::echo “$music.htm$”文件.
::echo 注意:如果当前目录下己存在“$music.htm$”,该文件将被替换。
::echo.
::echo code by freeants CMD@XP 15:03 2007-6-7 version:1.00
::echo ================================================================================
::pause
cls
echo 构造Html文件中
echo 请稍后……
echo ^<html^>>$music$.htm
echo ^<head^>>>$music$.htm
echo ^<meta http-equiv=Content-Type content="text/html; charset=gb2312"^>>>$music$.htm
echo ^<title^>by freeants^</title^>>>$music$.htm
echo ^<style type=text/css^>>>$music$.htm
echo ^<!-->>$music$.htm
echo A:link{text-decoration:none;color:#001F00;font-size:10pt; font-family: 宋体;}>>$music$.htm
echo A:visited{text-decoration:none;color:#0000ff;font-size:10pt; font-family: 宋体;}>>$music$.htm
echo A:hover{text-decoration:underline;color:#ff0000;font-size:10pt; font-family: 宋体;}>>$music$.htm
echo body{background-color:#345678;}>>$music$.htm
echo table{font-size:9pt;color:#008B8B;font-family: 宋体;}>>$music$.htm
echo td{background-color:#abcdef;}>>$music$.htm
echo center{font-size:18pt;color:#00BFFF;font-family:方正舒体;}>>$music$.htm
echo --^>>>$music$.htm
echo ^</style^>>>$music$.htm
echo ^</head^>>>$music$.htm
echo ^<body^>>>$music$.htm
echo ^<center^>Musics@LocalMachine^</center^>>>$music$.htm
echo ^<table width=80%% align=center border=0 cellspacing=2 cellpadding=5^>>>$music$.htm
setlocal enabledelayedexpansion
for /f "skip=1 tokens=1 delims=:" %%m in ('wmic logicaldisk where "drivetype=3" get caption') do set pth=!pth! %%m:\*.mp3
for /f "tokens=*" %%i in ('dir/a/s/b !pth! 2^>nul ^| sort') do (
set /a sign+=1
set /a num+=1
if !sign! equ 1 echo ^<tr^>>>$music$.htm
if %%~zi geq 1024000 (
set /a size=%%~zi/1024*100/1024
if "!size:~0,-2!" equ "" (set size=0.!size:~-2!) else (set size=!size:~0,-2!.!size:~-2!)
set size=.....大小:^<font style="color:#FF0000;"^>!size!^</font^> MB
) else (
if %%~zi geq 1024 (
set /a size=%%~zi*100/1024
set size=!size:~0,-2!.!size:~-2!
set size=.....大小:^<font style="color:#FF0000;"^>!size!^</font^> ^<font style="color:#FF00FF"^>KB^</font^>
) else (
set size=.....大小:^<font style="color:#FF0000;"^>%%~zi^</font^> ^<font style="color:#FF00FF"^>字节^</font^>
)
)
set name=%%~nxi
echo ^<td^>!num!:^<a title="歌曲名:%%~nxi。 文件大小:%%~zi 字节。 修改时间:%%~ti。" href="%%~i"^>!name:~,35!^</a^>!size!^</td^>>>$music$.htm
if !sign! equ 2 (
echo ^</tr^>>>$music$.htm
set sign=0
)
)
if !sign! equ 1 echo ^</tr^>>>$music$.htm
echo ^</table^>>>$music$.htm
echo ^<br^>^<center style="font-size:10pt;font-family:宋体;"^>This page was created by batch file.^ Designed by ^<font style="font-size:10pt;color:#fc8204;cursor:hand;"^>Freeants^</font^>.^</center^>>>$music$.htm
echo ^</body^>>>$music$.htm
echo ^</html^>>>$music$.htm
作者: HAT
时间: 2008-11-12 10:22
建议转移到批处理室
作者: fyjokre
时间: 2008-11-21 10:57
支持!!!