Reputation: 5946
I'm trying to go around the loop a fixed number of times, however I find I cannot seem to make this statement work with
REM @echo off
SET TotalCores=12
SET Sockets=2
SET SlaveNodes=4
SET /A mycores = %TotalCores% / %SlaveNodes%
FOR /L %i in (0,1,%SlaveNodes%) DO (call slavenode.bat %i %mycores)
Why do I get the following issue?
SET /A mycores = 12 / 4
SlaveNodesi was unexpected at this time.
Is my formatting correct?
Upvotes: 1
Views: 339
Reputation: 125757
Remove the spaces, and use double percent signs around your loop variable:
REM @echo off
SET TotalCores=12
SET Sockets=2
SET SlaveNodes=4
SET /A mycores=%TotalCores%/%SlaveNodes%
FOR /L %%i in (0,1,%SlaveNodes%) DO (call slavenode.bat %%i %mycores%)
Upvotes: 3
Reputation: 56238
in batch files you must use double percentsigns for the for-variables:
FOR /L %%i in (0,1,%SlaveNodes%) DO (call slavenode.bat %%i %mycores%)
(also you missed a %
with your variable %mycores%)
Upvotes: 1