For any question that amounts to "how can I find out information about my computer?", the answer is always to use wmic
.
for /F "delims=" %%A in ('wmic cpu get NumberOfCores /format:value ^| find "NumberOfCores"') do set %%A
for /L %%A in (1,1,%NumberOfCores%) do start "Batch Script" MyProgram.exe
Of course, if you're looking for a way to do math in batch, just use set /a
.
set /a loopcount=%NUMBER_OF_PROCESSORS%/2
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…