@Echo off
set url=http://wx.kanunu.cn/files/article/html/5/53721/3764203.html
:loop
if not "%url%"=="%url:/=%" (call :xyz) else (goto end)
goto loop
:xyz
for /f "tokens=1* delims=/" %%a in ("%url%") do (set "url=%%b")
goto :eof
:end
set "url=%url:.html=%"
set "url=%url:.htm=%"
echo %url%
pause
exit
考虑到网页文件的扩展名有时会是.htm,所以加了句set "url=%url:.htm=%"
[ Last edited by hmily88 on 2008-7-5 at 07:47 PM ]
作者: qianmo717 时间: 2008-7-5 20:02
@echo off
setlocal EnableDelayedexpansion
set str1=http://wwww.szdddd.com/7893.html
for %%i in (%str1%) do (
echo %%~nxi
set str3=%%~xi
set str2=%%~ni
for /l %%a in (1,1,10) do (
set /a str2+=1
echo !str2!!str3!
)
)
pause>nul
作者: balinger 时间: 2008-7-5 20:24
@echo off
set url=http://wx.kanunu.cn/files/article/html/5/53721/3764203.html
for /f "delims=" %%i in ("%url%") do (
echo %%~ni
echo %%~xi
echo %%~nxi
)
pause
作者: metoo 时间: 2008-7-5 20:30
@echo off&setlocal enabledelayedexpansion
set url=http://wx.kanunu.cn/files/article/html/5/53721/37642034.html
set url2=%url:/=\%
for %%a in ("%url2%") do (
set url2=%%~na
echo !url2!
)
偷了把鸡。。应该没啥问题
[ Last edited by metoo on 2008-7-5 at 08:31 PM ]
@echo off
set /p url=url?
for /f "tokens=2 delims=html" %%i in ("%url%") do set str=%%i&call :lp
pause>nul&goto :eof
:lp
set a=%str:~-1%
set var=%a%%var%
if "%a%" neq "/" set str=%str:~,-1%&goto lp
cls&echo %var:~1,-1%.html
作者: moniuming 时间: 2008-7-6 12:08
试试这个?
@echo off
set "var=http://wx.kanunu.cn/files/article/html/5/53721/3764203.html"
:again
for /f "tokens=1* delims=/." %%a in ("%var%") do (
if not "%%b"=="html" (
set var=%%b&goto :again
) else (
echo %%a
)
)
pause