![]() |
中国DOS联盟-- 联合DOS 推动DOS 发展DOS --联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum |
| 游客 | 登录 | 注册 | 会员 | 搜索 | 中国DOS联盟 |
|
中国DOS联盟论坛 现在时间是 2026-08-10 14:07 |
共 47,811 主题排行 / 349,897 发帖 / 今日 0 篇 / 48,255 会员排行 |
| DOS批处理 & 脚本技术(批处理室) » [原创]本地音乐文件搜索 |
| 可打印版本 995 / 2 |
| 第1楼 freeants001 | 发表于 2008-11-12 09:54 |
| 中级用户 发帖 244 积分 330 来自 湖北 | |
|
[原创]本地音乐文件搜索 ::=====================================================
:: 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 |
|
| 第2楼 HAT | 发表于 2008-11-12 10:22 |
| 版主 发帖 5,017 积分 9,023 | |
|
建议转移到批处理室
|
|
| 第3楼 fyjokre | 发表于 2008-11-21 10:57 |
| 社区乞丐 发帖 9 积分 -11 | |
|
支持!!!
|
|
|
[ 联系联盟系统管理团队 -
中国DOS联盟 -
标准版 ] Sponsored by ifanr Inc | © 2001–2023 |