昨天写完的东西,忘发了。功能简单在线查单词,数据来自金山词霸。
需要 wget 或 curl 支持,如果需要朗读功能的话需要 mplayer 支持。
用法:dict word ...
/F 完全模式查询单词。
word 可指定多个单词。
支持单词朗读功能。
所需软件链接:
mplayer:http://www.mplayerhq.hu
wget :http://users.ugent.be/~bpuype/wget/
或 curl:http://curl.haxx.se/
[ Last edited by 无奈何 on 2007-1-4 at 01:16 AM ]
需要 wget 或 curl 支持,如果需要朗读功能的话需要 mplayer 支持。
用法:dict word ...
/F 完全模式查询单词。
word 可指定多个单词。
支持单词朗读功能。
所需软件链接:
mplayer:http://www.mplayerhq.hu
wget :http://users.ugent.be/~bpuype/wget/
或 curl:http://curl.haxx.se/
无奈何发表于 2007-01-03 12:11
- :::::::::::::::::::::::::::::::::::::::::::::::::
- :: dict.cmd -V0.1 -- 批处理在线查单词
- :: 无奈何@cn-dos.net - 2007-1-2
- :: 用法:dict word ...
- :: 支持文件: - mplayer.exe wget.exe or curl.exe
- :::::::::::::::::::::::::::::::::::::::::::::::::
- @echo off
- setlocal ENABLEDELAYEDEXPANSION
- set mp3file="%TEMP%\dict.mp3"
- rem 依赖文件检查
- :mplay
- call mplayer >nul 2>nul
- if "%ERRORLEVEL%" == "1" set nomplay=1
- :wget
- wget.exe >nul 2>nul
- if not "%ERRORLEVEL%" == "9009" (
- set "command1=wget -q -O - "
- set "command2=wget -q -O %mp3file%"
- goto star
- )
- :curl
- curl.exe >nul 2>nul
- if not "%ERRORLEVEL%" == "9009" (
- set "command1=curl -s "
- set "command2=curl -s -o %mp3file%"
- goto star
- )
- echo.本脚本需要 wget 或 curl 的支持。
- goto :EOF
- :star
- set flag=0
- if "%~1" == "" goto help
- if "%~1" == "?" goto help
- if "%~1" == "/?" goto help
- if "%~1" == "/F" shift &goto full
- if "%~1" == "/f" shift &goto full
- :next
- if "%~1" == "" goto :EOF
- set "word=%~1"
- call :down
- shift
- goto :next
- :full
- if "%~1" == "" goto :EOF
- set mp3=
- del %mp3file% 2>nul
- set "word=%~1"
- call :down
- %command2% "%mp3%"
- echo.--------------------------------
- if "%mp3%" == "" echo.查看详解 退出 &goto :Nselect
- echo.朗读 查看详解 退出
- :Nselect
- set select=
- set /p select=请选择:
- call :Parse
- if "%quit%" == "1" goto :EOF
- shift
- goto :full
- :Parse
- for %%s in (R r F f A a) do if "%%s" == "%select%" goto Switch%select%
- goto :EOF
- :SwitchR
- if "%nomplay%" == "1" echo. 播放影音需要 mplayer 支持。&goto :Nselect
- start /min %ComSpec% /c "mplayer %mp3file%>nul"
- goto :Nselect
- goto :EOF
- :SwitchF
- start http://www.iciba.com/search?s=%word%
- goto :Nselect
- goto :EOF
- :SwitchA
- set quit=1
- goto :EOF
- :down
- set url="http://dict.cn/ws.php?q=%word%"
- echo.
- echo.单词:%word%
- echo.释义:
- for /f "tokens=1,2,3 delims=<>" %%a in ('%command1% %url%') do (
- if "%%a" == "audio" set "mp3=%%b"
- if "%%b" == "Not Found" echo 无此单词^^! &goto :EOF
- if "%%c" == "/def" echo %%b &goto :EOF
- if "%%b" == "/def" echo %%a &set flag=0
- if "!flag!" == "1" echo %%a
- if "%%a" == "def" echo %%b &set flag=1
- )
- goto :EOF
- :help
- echo.批处理在线查单词
- echo.
- echo.用法:dict word ...
- echo.
- echo /F 完全模式查询单词。
- echo word 可指定多个单词。
- goto :EOF
[ Last edited by 无奈何 on 2007-1-4 at 01:16 AM ]
本帖最近评分记录
(共 6 条)
点击查看详情
☆开始\运行 (WIN+R)☆
%ComSpec% /cset,=何奈无── 。何奈可无是原,事奈无做人奈无&for,/l,%i,in,(22,-1,0)do,@call,set/p= %,:~%i,1%<nul&ping/n 1 127.1>nul
%ComSpec% /cset,=何奈无── 。何奈可无是原,事奈无做人奈无&for,/l,%i,in,(22,-1,0)do,@call,set/p= %,:~%i,1%<nul&ping/n 1 127.1>nul
