I want to create a batch script of Windows, through which it allows the user to enter several options at a time, and then after that the program will work.
Regarding this website ( Multiple selection menus in a batch file? ), I find out that it somehow works to allow multiple selection. However, this is done in bash scripts. For instance...
@echo off
setlocal enabledelayedexpansion
echo Which would you like to use?
echo 1. Hello.txt
echo 2. Byebye.txt
echo 3. ThisIsText.txt
echo 4. MyBatchScript.txt
echo 5. All
set /p op=Type the numbers of the names you want to use (separated by commas with no spaces. E.g: 1,3,2):
It still works, inviting users to select one or more options.
for /f "delims=, tokens=1-5" %%i in ("op") do (
set i=%%i
set j=%%j
set k=%%k
set l=%%l
set m=%%m
)
, "op", i. , j, k, l m . , . , .
, ...
1 ,
"Hello.txt" (.)
echo This is complicated > Hello.txt
1 (, 1,2),
echo This is complicated > Hello.txt
echo This is complicated > Byebye.txt
"5", ( ). - This is complicated > Byebye.txt, Hello.txt ..
?
: - ? , . , . . : , -.
if %i%X neq X set last=1b & goto %i%
:1b
if %j%X neq X set last=2b & goto %j%
:2b
if %k%X neq X set last=3b & goto %k%
:3b
if %l%X neq X set last=4b & goto %l%
:4b
if %m%X neq X set last=%m% & goto %m%
goto next
:1
::Put the code for doing the first option here
goto %last%
:2
::Put the code for doing the second option here
goto %last%
:3
::Put the code for doing the third option here
goto %last%
:4
::Put the code for doing the fourth option here
goto %last%
:5
::Put the code for doing the fifth option here
goto %last%
, . 1,2,3 , , ?