本帖最后由 aloha20200628 于 2024-7-8 13:39 编辑
回复 6# hnfeng
因为要先提取 ‘任务名称’ 这个中文字段,故须确认1.html的编码,以下代码假设其为系统默认编码(936 即 gb2312);
若1.html是utf-8编码,则须抹去代码第2行首的::注释前缀,还须将代码脚本存为utf-8编码后运行...
- @echo off &set "hF=1.html"
- ::chcp 65001>nul & @echo off
- for /f "tokens=1 delims=:" %%n in (' findstr /lnc:">任务名称<" "%hF%" ') do set/a "n=%%n+1"
- (for /f "tokens=4 delims=<>" %%a in (' findstr /n ".*" "%hF%"^|findstr /lbc:"%n%:" ') do echo,%%a)>1.txt
- (for /f "tokens=3 delims=<>(" %%a in (
- ' findstr /rc:"[0-9][0-9]:[0-9][0-9]:[0-9][0-9]" "%hF%" ') do @echo,%%a)|sort>>1.txt
- pause&exit/b
复制代码
|