所以我创建了一个允许直接访问流的小脚本。我在twitch.tv/%stream[%%i]%
遇到问题,我想用数组中的流媒体用户名替换%stream[%%i]%
" stream"。
@echo off
echo Streamer list:
setlocal enabledelayedexpansion
set stream[0]=dakotaz
set stream[1]=kingrichard
set stream[2]=ninja
set stream[3]=tsm_myth
set /a i=1
for /l %%n in (0,1,3) do (
echo !i!. !stream[%%n]!
set /a i=i+1
)
set /p i=Which streamer would you like to watch?
set /a i=i-1
livestreamer --twitch-oauth-token xxxxxxx twitch.tv/%stream[%%i]% best
我不确定它是否可能,我以前从未使用批次。
答案 0 :(得分:0)
正如Squashman已经指出的那样,解决变量的正确方法是!stream[%i%]!
。
我建议做一点改变,使其更加直接(没有必要从零开始计算):
@echo off
echo Streamer list:
setlocal enabledelayedexpansion
set stream[1]=dakotaz
set stream[2]=kingrichard
set stream[3]=ninja
set stream[4]=tsm_myth
for /l %%n in (1,1,4) do (
echo !i!. !stream[%%n]!
)
set /p i=Which streamer would you like to watch?
livestreamer --twitch-oauth-token xxxxxxx twitch.tv/!stream[%i%]! best