为什么说零而不是停用?

时间:2016-09-30 23:47:35

标签: batch-file set

set /a wave1=0

set /a wave2=0

set /a wave3=1

set /a wave4=0

set /a wave5=0

set /a wave6=1

set /a wave7=0

set /a wave8=0


if %wave1%==1 set wwave1=ACTIVATED

if %wave1%==0 set wwave1=DEACTIVATED

if %wave2%==1 set wwave2=ACTIVATED

if %wave2%==0 set wwave2=DEACTIVATED

if %wave3%==1 set wwave3=ACTIVATED

if %wave3%==0 set wwave3=DEACTIVATED 

if %wave4%==1 set wwave4=ACTIVATED

if %wave4%==0 set wwave4=DEACTIVATED

if %wave5%==1 set wwave5=ACTIVATED

if %wave5%==0 set wwave5=DEACTIVATED 

if %wave6%==1 set wwave6=ACTIVATED

if %wave6%==0 set wwave6=DEACTIVATED

if %wave7%==1 set wwave7=ACTIVATED

if %wave7%==0 set wwave7=DEACTIVATED

if %wave8%==1 set wwave8=ACTIVATED

if %wave8%==0 set wwave8=DEACTIVATED

echo Type the number of the wave you like to change

echo Or press B to go back

echo       wave  ____       STATUS

echo -----------------------------------

echo     wave 1          %wwave1%

echo     wave 2          %wwave2%

echo     wave 3          %wwave3% 

echo     wave 4          %wwave4%

echo     wave 5          %wwave5%

echo     wave 6          %wwave6%

echo     wave 7          %wwave7%

echo     wave 8          %wwave8% 

1 个答案:

答案 0 :(得分:1)

这不是 您问题的答案。

我建议你阅读Array management in Batch files

@echo off
setlocal EnableDelayedExpansion

for /L %%i in (1,1,8) do set /a "wave%%i=^!(%%i%%3)"
set "val[0]=DEACTIVATED"
set "val[1]=ACTIVATED"

for /L %%i in (1,1,8) do for %%j in (!wave%%i!) do set "wwave%%i=!val[%%j]!"

echo Type the number of the wave you like to change
echo Or press B to go back
echo       wave  ____       STATUS
echo -----------------------------------
for /L %%i in (1,1,8) do echo     wave %%i          !wwave%%i!