mardi 20 mars 2018

Check for duplicates in batch not outputting

I have this code snippet where I am trying to catch for duplicates in an array but everytime I try to run it in the script it errors out saying "The system cannot find the path specified. FINDSTR: Cannot open" Here is the code snippet:

:defenders
set i=0
for %%a in (Vigil Ela Lesion Mira Echo Caviera Valkyrie Frost Mute
            Smoke Castle Pulse Doc Rook Jager Bandit Tachanka Kapkan) do (
   set /A i+=1
   set operator[!i!]=%%a
)
for /L %%a in (1,1,%player%) do (
   set /A "randIndex=(!random!*i)/18+1"
   set /A "operators[%%a]=operator[!randIndex!], operator[!randIndex!]=operator[!i!], i-=1"
)
exit /B
:defense
call :colorEcho 67 "Round %round% - Attackers"
echo.
for /l %%x in (1, 1, %player%) do (
call :defenders
call :colorEcho 07 !operator!
echo/
)

colorEcho, round, and player are defined elsewhere, they worked in the past and are not causing this issue

I will provide more of the original script if need be but this I just really confusing me...I'm more on the newer side to batch so it's probably a simple issue but I still can't figure it out. Any help and suggestions are much appreciated!!




Aucun commentaire:

Enregistrer un commentaire