How to integrate batch script multiple selections into JAVA GUI?

后端 未结 2 1763
梦如初夏
梦如初夏 2020-12-21 18:28

EDITED 27/7/2014

PLEASE READ CAREFULLY AS MY QUESTION IS A BIT COMPLICATED

Hi, I wanted to do a coding whereby it involves a JAVA GUI, batch

2条回答
  •  轮回少年
    2020-12-21 18:47

    Change this line:

    if %choices% equ 6 set choices=1,2,3,4,5
    

    by this one:

    if "%choices:6=%" neq "%choices%" set choices=1,2,3,4,5
    

    I also suggest you to use arrays.

    EDIT: Example added

    @echo off
    
    :getOptions
    set "choices="
    set /P "choices=Choices: "
    if not defined choices goto :EOF
    if "%choices:6=%" neq "%choices%" set choices=1,2,3,4,5,6
    echo Execute: %choices%
    goto getOptions
    

    Example output:

    C:\> test.bat
    Choices: 1,3,5
    Execute: 1,3,5
    Choices: 1,2,4,6
    Execute: 1,2,3,4,5,6
    Choices: 1,6
    Execute: 1,2,3,4,5,6
    Choices:
    

    EDIT: I obviously made the error of also include 6 in the replacement, but you get the point!

提交回复
热议问题