标题: 处理asp网页地址的脚本
[打印本页]
作者: abczxc
时间: 2007-11-17 22:15
标题: 处理asp网页地址的脚本
有类似下面一个地址
http://vod/oemui/player.asp?id=8519 ,怎么把8519读出来,并把它写成
http://192.168.0.234/webmedia/abc&efg&local=*.*.*.*/&prog_id=8519
其中*.*.*.*代表本机的ip,也就是说下面的地址“*.*.*.*”和“8519”是变化的。
最后,把上面的地址echo出来就可以了。
vbs和bat都行,只要能处理类似
http://vod/oemui/player.asp?id=****的地址就行。
[
Last edited by abczxc on 2007-11-19 at 06:59 PM ]
作者: lxmxn
时间: 2007-11-17 23:36
命令行执行:
Quote: |
for /f "delims=[] tokens=2" %a in ('ping/n 1 %ComputerName%') do @echo:The IP Address is : [%a]&echo:http://vod/oemui/player.asp?id=8519|sed -r "s,.*id=([0-9]*)$,http://192.168.0.234/webmedia/abc\&efg\&local=%a/\&prog_id=\1," |
|
[
Last edited by lxmxn on 2007-11-17 at 11:38 PM ]
作者: abczxc
时间: 2007-11-18 17:54
我1楼写错了关键几个字,不好意思
还是要谢谢斑竹呀,您给了我思路,真是犀利啊
我for学的不好,能再帮我改下,把下面的1.url文件拖到您写的bat文件上面就echo出来结果
用vbs写个也行,我只会在vbs上把变量传到剪贴板,不知道bat命令怎么把最后的结果传到剪贴板
[InternetShortcut]
URL=http://vod/oemui/player.asp?id=8519
[
Last edited by abczxc on 2007-11-18 at 07:34 PM ]
作者: abczxc
时间: 2007-11-18 22:31
谁能再帮我一下啊
作者: lxmxn
时间: 2007-11-18 22:50
@echo off&SetLocal
if "%~1"=="" echo error&goto:eof
if /i not "%~x1"==".url" echo error:not url file & goto :eof
if not exist %~s1 echo error:file is not exist&goto:eof
for /f "delims=[] tokens=2" %%a in ('ping/n 1 %computername%') do set ipaddress=%%a
for /f "delims== tokens=1*" %%a in ('findstr /i "^URL" %~s1') do set urladdress=%%b
rem echo %ipaddress%--%urladdress%
echo:%urladdress%|sed -r "s,.*id=([0-9]+)[ \t]*$,http://192.168.0.234/webmedia/abc\&efg\&local=%ipaddress%/\&prog_id=\1,"
pause
如果需要复制到剪切板,在论坛搜索 winclip
作者: abczxc
时间: 2007-11-19 18:55
I'm extremely grateful to you.
作者: lxmxn
时间: 2007-11-19 19:34
No thanks
