再次感谢!
这个问题解决了,现在已经正确取出来了。目前只剩下3楼说道的,UTF8转成GBK的问题了,我回到家再查查。
@echo off & color 02 & setlocal enabledelayedexpansion
@rem/ init
set temp_path_last=1
for /f "delims=<> tokens=1-5" %%a in ('findstr /i "<DT><H3[^>]*>.*</H3> <DT><A[^>]*>.*</A>" bookmarks_ansi.html') do (
@rem/ echo a=%%a;b=%%b;c=%%c;d=%%d;e=%%e;
if /i "%%e"=="/H3" (echo\&echo\-----& call:sub_fix_path "#%%a#" %%d)
if /i "%%e"=="/A" (
(for /f "usebackq tokens=2" %%a in ('%%c') do (
set mystr=%%a
echo url=!mystr:~5!;
)) 2>nul
echo notes=%%d
)
)
endlocal&pause
goto :eof
:sub_fix_path
set temp_path=%~1
set temp_path_name=%2
if "%temp_path%"=="# #" set temp_path=1
if "%temp_path%"=="# #" set temp_path=2
if "%temp_path%"=="# #" set temp_path=3
if "%temp_path%"=="# #" set temp_path=4
if "%temp_path%"=="# #" set temp_path=5
if "%temp_path%"=="# #" set temp_path=6
set "tmp_dir%temp_path%=%temp_path_name%\\"
if %temp_path% EQU 1 ( set "tmp_dir2=" & set "tmp_dir3=" & set "tmp_dir4=" & set "tmp_dir5=" )
if %temp_path% EQU 2 ( set "tmp_dir3=" & set "tmp_dir4=" & set "tmp_dir5=" )
if %temp_path% EQU 3 ( set "tmp_dir4=" & set "tmp_dir5=" )
if %temp_path% EQU 4 ( set "tmp_dir5=" )
set temp_path_full=%tmp_dir1%%tmp_dir2%%tmp_dir3%%tmp_dir4%%tmp_dir5%
set temp_path_last=%temp_path%
echo mkdir "%temp_path_full%"
goto :eof
这个问题解决了,现在已经正确取出来了。目前只剩下3楼说道的,UTF8转成GBK的问题了,我回到家再查查。
@echo off & color 02 & setlocal enabledelayedexpansion
@rem/ init
set temp_path_last=1
for /f "delims=<> tokens=1-5" %%a in ('findstr /i "<DT><H3[^>]*>.*</H3> <DT><A[^>]*>.*</A>" bookmarks_ansi.html') do (
@rem/ echo a=%%a;b=%%b;c=%%c;d=%%d;e=%%e;
if /i "%%e"=="/H3" (echo\&echo\-----& call:sub_fix_path "#%%a#" %%d)
if /i "%%e"=="/A" (
(for /f "usebackq tokens=2" %%a in ('%%c') do (
set mystr=%%a
echo url=!mystr:~5!;
)) 2>nul
echo notes=%%d
)
)
endlocal&pause
goto :eof
:sub_fix_path
set temp_path=%~1
set temp_path_name=%2
if "%temp_path%"=="# #" set temp_path=1
if "%temp_path%"=="# #" set temp_path=2
if "%temp_path%"=="# #" set temp_path=3
if "%temp_path%"=="# #" set temp_path=4
if "%temp_path%"=="# #" set temp_path=5
if "%temp_path%"=="# #" set temp_path=6
set "tmp_dir%temp_path%=%temp_path_name%\\"
if %temp_path% EQU 1 ( set "tmp_dir2=" & set "tmp_dir3=" & set "tmp_dir4=" & set "tmp_dir5=" )
if %temp_path% EQU 2 ( set "tmp_dir3=" & set "tmp_dir4=" & set "tmp_dir5=" )
if %temp_path% EQU 3 ( set "tmp_dir4=" & set "tmp_dir5=" )
if %temp_path% EQU 4 ( set "tmp_dir5=" )
set temp_path_full=%tmp_dir1%%tmp_dir2%%tmp_dir3%%tmp_dir4%%tmp_dir5%
set temp_path_last=%temp_path%
echo mkdir "%temp_path_full%"
goto :eof
