@echo off
setlocal EnableDelayedExpansion
wget --output-document=Content.xml Link
for /f "tokens=1" %%a in ('find "1280x720" Content.xml') do set found=%%a
set Url=!found:~5,-6!
for /f "delims=" %%a in (""!Url!"") do endlocal & set "Url=%%~a"
set Filename=Whatever.mp4
:start
rtmpdump -r %Url% -e -b 60000000 -o C:\Users\User\Desktop\%Filename%
if ERRORLEVEL 2 goto start
if exist Content.xml del Content.xml惠特正确地完成了它的工作。
相关行正确地存储在Url变量中。
rtmpdump不工作。
Id est,而不是显示MP4的数据(如INFO:)和开始下载,它说“从0.000kB开始下载”(预期),并停留在那里直到超时(不期望)。过了一会儿,出现了一个“错误: RTMP_ReadPacket,未能读取RTMP数据包报头”。然后,根据:start循环,它一次又一次地执行相同的操作(或直到停止)。
@echo off
set Url=rtmpe://Stuff.mp4
set Filename=Whatever.mp4
:start
rtmpdump -r %Url% -e -b 60000000 -o C:\Users\User\Desktop\%Filename%
if ERRORLEVEL 2 goto start这(在从Content.xml文件中读取rtmpe行之后,手动输入它)可以工作。
链接、用户、东西等显然是数据的占位符,我认为这些数据与手头的问题无关。
值得注意的是:在第一个文件中手动设置Url仍然会导致错误,除非是在endlocal语句之后完成的。
我相信问题可能在于如何存储“局部变量”,但我对此没有概念。
那么,有谁能解释一下这里发生了什么,以及如何解决呢?
发布于 2014-11-16 19:22:31
我不认为有任何理由在批处理文件中使用延迟的环境变量展开来执行此任务。
@echo off
wget.exe --output-document=Content.xml Link
for /f "tokens=1" %%a in ('%SystemRoot%\System32\find.exe "1280x720" Content.xml') do set found=%%a
set "Url=%found:~5,-6%"
set "Filename=Whatever.mp4"
set "LoopCount=0"
:Loop
rtmpdump.exe -r %Url% -e -b 60000000 -o "%USERPROFILE%\Desktop\%Filename%"
if not errorlevel 2 goto EndBatch
set /A "LoopCount+=1"
if not "%LoopCount%"=="3" goto Loop
:EndBatch
if exist Content.xml del Content.xmlhttps://stackoverflow.com/questions/26960746
复制相似问题