samedi 18 février 2017

Simple batch script random number generator

I am new to using the %random% command in batch scripts and I am trying to create a batch script to randomly create a number between 0 and 3. I wrote the following but with every instance (everytime I double-click the BAT file) I get the same number '1'. This defeats the purpose. Which is based on this number copy over a selected video file so it is random.

echo off set numb=" " set /a numb=%random% / 10000 echo %numb% :only used for testing pause :only used for testing

if %numb% LEQ 1 goto trailer if %numb% EQU 2 goto dragon if %numb% EQU 3 goto live

:dragon echo Dragon copy /Y "F:\Skyrim SSE\mod backup - files\Dragon flyby - BGS_Logo.bik" "D:\SteamLibrary\steamapps\common\Skyrim Special Edition\Data\Video\BGS_Logo.bik" exit

:trailer echo Trailer copy /Y "F:\Skyrim SSE\mod backup - files\Official Trailer-BGS_Logo.bik" "D:\SteamLibrary\steamapps\common\Skyrim Special Edition\Data\Video\BGS_Logo.bik" exit

:live Echo Live copy /Y "F:\Skyrim SSE\mod backup - files\Dragonborne-live-BGS_Logo.bik" "D:\SteamLibrary\steamapps\common\Skyrim Special Edition\Data\Video\BGS_Logo.bik" exit


I want to keep this as simple as possible as this really doesn't need to be complicated. Please help




Aucun commentaire:

Enregistrer un commentaire