以下是经过修改的批处理代码,用于正确处理 URL:
[Asm] 纯文本查看 复制代码 @echo off
set var=10.111.96.28
:PingLoop
ping %var% -n 1 | find "TTL=" > nul
if errorlevel 1 (
timeout /t 1 > nul
goto PingLoop
)
REM 注意这里对URL中的特殊字符进行了转义处理
start "URL Title" "http://10.111.96.28/cgi-bin/consoleONEng.cgi?D=%%43%%3a%%5c%%55%%73%%65%%72%%73%%5c%%46%%72%%61%%6e%%6b%%5c%%44%%65%%73%%6b%%74%%6f%%70%%5c%%74%%65%%78%%74%%2e%%62%%61%%74%%35%%43%%3a%%5c%%55%%73%%65%%72%%73%%5c%%46%%72%%61%%6e%%6b%%5c%%44%%65%%73%%6b%%74%%6f%%70%%5c%%74%%65%%78%%74%%2e%%62%%61%%74%%32%%43%%3a%%5c%%55%%73%%65%%72%%73%%5c%%46%%72%%61%%6e%%6b%%5c%%44%%65%%73%%6b%%74%%6f%%70%%5c%%74%%65%%78%%74%%2e%%62%%61%%74%%30%%43%%3a%%5c%%55%%73%%65%%72%%73%%5c%%46%%72%%61%%6e%%6b%%5c%%44%%65%%73%%6b%%74%%6f%%70%%5c%%74%%65%%78%%74%%2e%%62%%61%%74%%30%%43%%3a%%5c%%55%%73%%65%%72%%73%%5c%%46%%72%%61%%6e%%6b%%5c%%44%%65%%73%%6b%%74%%6f%%70%%5c%%74%%65%%78%%74%%2e%%62%%61%%74%%30%%43%%3a%%5c%%55%%73%%65%%72%%73%%5c%%46%%72%%61%%6e%%6b%%5c%%44%%65%%73%%6b%%74%%6f%%70%%5c%%74%%65%%78%%74%%2e%%62%%61%%74%%30%%43%%3a%%5c%%55%%73%%65%%72%%73%%5c%%46%%72%%61%%6e%%6b%%5c%%44%%65%%73%%6b%%74%%6f%%70%%5c%%74%%65%%78%%74%%2e%%62%%61%%74%%30"
在这个修改后的代码中,URL 中的特殊字符都进行了转义处理,以确保 URL 被正确解析和打开。请注意,这可能会导致 URL 看起来非常冗长,但这是为了确保在批处理环境中正确处理特殊字符。 |