随机文件选择器在每次执行时选择相同的值(批处理)
Random File Picker Picks Same Value On Each Execution (batch)
我正在尝试通过脚本使用此软件启动一个随机文件 - 唯一的问题是此脚本在每次启动时总是选择相同的随机数。我总是 41...有什么建议吗?
@echo on
setlocal EnableDelayedExpansion
cd C:\Users\User\Documents\Downloads\Nintendo
set n=0
for %%f in (*.*) do (
set /A n+=1
set "file[!n!]=%%f"
)
set /A "rand=%random% * 100 / 32768+1"
"C:\Users\User\Downloads\fceux-2.2.2-win32\fceux.exe" "!file[%rand%]!"
对我有用:
@echo off
setlocal enabledelayedexpansion
c:
cd \windows
for %%f in (*.*) do (
set /A n+=1
set "file[!n!]=%%f"
)
rem change random seed value
for /l %%i in (0,1,%time:~-2%) do set /A tmp=!random!
set /A rand=!random! %% n-1
echo "!file[%rand%]!"
我正在尝试通过脚本使用此软件启动一个随机文件 - 唯一的问题是此脚本在每次启动时总是选择相同的随机数。我总是 41...有什么建议吗?
@echo on
setlocal EnableDelayedExpansion
cd C:\Users\User\Documents\Downloads\Nintendo
set n=0
for %%f in (*.*) do (
set /A n+=1
set "file[!n!]=%%f"
)
set /A "rand=%random% * 100 / 32768+1"
"C:\Users\User\Downloads\fceux-2.2.2-win32\fceux.exe" "!file[%rand%]!"
对我有用:
@echo off
setlocal enabledelayedexpansion
c:
cd \windows
for %%f in (*.*) do (
set /A n+=1
set "file[!n!]=%%f"
)
rem change random seed value
for /l %%i in (0,1,%time:~-2%) do set /A tmp=!random!
set /A rand=!random! %% n-1
echo "!file[%rand%]!"