我现在的脚本如下:
@echo off
setlocal
:::eg.:http://192.168.0.60:9080/ReportCenter/frameset?__report=default.rptdesign&__reportxml=/report/xml/4.6.1.xml&condition=null
set "serverIP=http://192.168.0.60:9080"
set "baseUrl=%serverIP%/ReportCenter/frameset?__report=default.rptdesign^&__reportxml=/report/xml/"
set "urlSuffix=^&condition=null"
set "cache=b:"
set "template=B:\make_index\html1.txt"
set "htmlFilenam=%cache%\index.html"
type %template% >%htmlFilenam%
for /r %%i in (*.xml) do call:process %%i
echo ^</body^> >>%htmlFilenam%
echo ^</html^> >>%htmlFilenam%
goto:eof
:process
::::echo %1
echo fn %~n1%~x1
set "xml=%~n1%~x1"
set "url=%baseUrl%%xml%%urlSuffix%"
:::echo "url=%url%"
echo ^<a href="%url%"^>%url%^</a^>^<br/^> >>%htmlFilenam%
goto:eof
遇到的困难就是产生的index网页文件中的链接不对。
不明白为什么在地址部分的还有^符号,而显示部分正常(没有^符号)。
《a href=“地址部分”》显示部分《/a》。
<a href="http://192.168.0.60:9080/ReportCenter/frameset?__report=default.rptdesign^&__reportxml=/report/xml/4.1.10.xml^&condition=null">http://192.168.0.60:9080/ReportCenter/frameset?__report=default.rptdesign&__reportxml=/report/xml/4.1.10.xml&condition=null</a><br/>