|
|
- @echo off
- setlocal enabledelayedexpansion
- echo Generate html Download page from txt (for e2dk)
- set Inputfile=%1
- set Outputfile=%~n1%.html
- if exist %Outputfile% (
- del %Outputfile%
- )
- echo ^<html^> >%Outputfile%
- echo ^<body^> >>%Outputfile%
- echo ^<head^> >>%Outputfile%
- echo ^<title^> >>%Outputfile%
- echo Generated from %Inputfile%>>%Outputfile%
- echo ^</title^> >>%Outputfile%
- for /f "delims=" %%i in ('findstr "ed2k" %Inputfile%')do (
- echo ^<p^> >> %Outputfile%
- echo ^<a href ^= ^">>%Outputfile%
- echo %%i>> %Outputfile%
- echo ^"^>>> %Outputfile%
- echo %%i >> %Outputfile%
- echo ^</a^> >> %Outputfile%
- echo ^<br/^> >> %Outputfile%
- echo ^</p^> >> %Outputfile%
- )
- echo ^</body^> >>%Outputfile%
- echo ^</html^> >>%Outputfile%
- pause
复制代码 这段代码就是为了将txt里的e2dk地址抽取出来输出成html的超链以方便下载软件一键下载。
但是遇到一个奇怪的问题,望各位大大解答
1.该批处理如果 在命令行下运行,输出的html文件在当前目录。但是如果是采用拖拽将txt文件拖到bat上运行,所输出的html 就变至
C:\Documents and Settings\user\下了
请问这是为什么?两种执行方式有什么不同?另 和直接双击执行又有什么不同?
2.请问如何规避/解决这个问题 |
|