@echo off
cls
Color 0A
if exist index.html del index.html
wget -q --show-progress http://cemu.info/
setlocal disableDelayedExpansion
for /f delims^=^ eol^= %%A in ('findstr /ri /c:"http://cemu.info/releases/" /c:"http://cemu.info/releases/" index.html') do (
set "ln=%%A"
setlocal enableDelayedExpansion
set "ln=!ln:*:=!"
if /i "!ln:~0,5!" equ "http://cemu.info/releases/" (set "ln=!ln:~5!") else set "ln=!ln:* "http://cemu.info/releases/ =!"
for /f %%B in ("!ln!") do if "%%B" neq "" echo "http:%%B" > cemu_ver.txt
endlocal
)
if exist index.html del index.html
notepad.exe cemu_ver.txt
它有效但不是http://cemu.info/releases/cemu_1.8.1.zip
打印" http://cemu.info/releases/cemu_1.8.1.zip""
(单个"开头是双#34;"最后)
也http:被删除,这让我很困扰
无论如何要解决这个问题?
答案 0 :(得分:0)
我找到了一个解决方法:
@echo off
cls
Color 0A
if exist index.html del index.html
.\bin\wget -q --show-progress http://cemu.info/
setlocal disableDelayedExpansion
for /f delims^=^ eol^= %%A in ('findstr /ri /c:"http://cemu.info/releases/" /c:"http://cemu.info/releases/" index.html') do (
set "ln=%%A"
setlocal enableDelayedExpansion
set "ln=!ln:*:=!"
if /i "!ln:~0,5!" equ "http://cemu.info/releases/" (set "ln=!ln:~5!") else set "ln=!ln:* "http://cemu.info/releases/ =!"
for /f %%B in ("!ln!") do if "%%B" neq "" echo http:%%B > cemu_ver.txt
endlocal
)
if exist index.html call :add-quote
goto skip-quote
:add-quote
set /p cemu_ver=<cemu_ver.txt
echo "%cemu_ver% > cemu_ver.txt
del index.html
(goto) 2>NUL
:skip-quote
notepad.exe cemu_ver.txt
答案 1 :(得分:0)
为什么这么复杂,使用"
作为分隔符并获取tokens=2
@echo off
cls
Color 0A
if exist index.html del index.html
wget -q http://cemu.info/
for /f tokens^=2delims^=^" %%A in (
'findstr /i /c:"http://cemu.info/releases/" /c:"http://cemu.info/releases/" index.html'
) Do > cemu_ver.txt Echo:"%%A"