Questions tagged [batch-choice]
27 questions
0
votes
2 answers
I can't understand choice error codes of batch
If I have a code like this:
@echo off
choice /C BL /M "Clear screen or list actual directory"
if errorlevel 2 goto l
if errorlevel 1 goto b
:l
tree /f
goto final
:b
cls
goto final
:final
I know this actually works, but I'm confused about one…

Adrián Jaramillo
- 279
- 2
- 12
0
votes
1 answer
All option in choice command
I am wondering if there is a nice and clean way to add a "select all choices" when building a choice menu in batch.
Currently I have the choice setup as clear item 1, clear item 2, clear item 3 (clear all), exit, and a timeout that the user cannot…

jsc
- 67
- 1
- 1
- 8
0
votes
3 answers
Windows .batch Choice command always chooses the same choice no matter input
I'm doing a project to help myself learn batch a little better. I have code which is meant to be a "UI" of sorts.
The snippet I have an issue with is this:
:install_check
if exist UI (
echo UI is already installed; reinstall?
CHOICE
if Errorlevel 1…

Excallypurr
- 319
- 1
- 16
0
votes
1 answer
Why is this Choice command not working (batch-file)
I have this
@echo off
:1
cls
echo Navigation: W-Up, S-Down, E-Enter
echo _________________________________
echo -(Option 1)
echo Option 2
echo Option 3
choice /c WSE /n
if ERRORLEVEL 1 goto 3
if ERRORLEVEL 2 goto 2
if ERRORLEVEL 3 goto…
user7668768
0
votes
2 answers
Batch file choice loop on unexpected input
So I have this choice:
echo.
echo All done. What would you like to do next?
echo 1. Open output folder
echo 2. Exit
echo.
set /p Choose=" Select 1 or 2 and press Enter: "
if '%Choose%'==1 goto show
if '%Choose%'==2 goto end
The problem is,…

George Hovhannisian
- 677
- 7
- 28
0
votes
1 answer
Batch File Choice Command and Running code
When using the CHOICE command, is there a way to make other code run at the same time?
For example, I am trying to create a timer that counts up. I want to make it so the choice option appears while the timer is sill running.
@echo off
set /a…

I_boom5245
- 21
- 3
0
votes
1 answer
CHOICE /c wasd /n /t 0.5
I have tried to use the choice /c adqps /n /t 0.5 /d s command in a batch file, but cannot find any way to test for user input for less than a second.
I have not been able to find an answer anywhere on the internet. (Even page 10 of Google…

Matthew Horvath
- 186
- 1
- 12
0
votes
1 answer
Deleting a folder after a confirmation prompt using a batch file
I am attempting to use a batch file to delete a folder, lets say it's called "D:\Pictures\1\Test". I want cmd to confirm that I want to delete the file before it deletes it using a single press of the "Y" key for yes, or the "N" key for no.
The code…

MrPlatipus
- 13
- 3
0
votes
1 answer
Backup Folder Batch with Date and a prompt for adding text
I already have a batch file that does the backup renaming the folder adding the date:
@echo on
for /f "delims=" %%a in ('wmic OS Get localdatetime ^| find "."') do set dt=%%a
set YYYY=%dt:~0,4%
set MM=%dt:~4,2%
set DD=%dt:~6,2%
set…

Nicola
- 1
0
votes
2 answers
Batch - Set variable through choice command
I'm working on a small batch script, which includes a section similar to the code block below... it would be an understatement to say this has befuddled me to the point where my mind has gone completely numb... why on gaias green backside does this…

Albert F D
- 529
- 2
- 13
- 33
0
votes
1 answer
Why does choice.com creates an infinite loop in a Batch file?
Yesterday, I have downloaded the choice.com command from this FTP link to use it on Windows XP. From command line it works correctly, as you can see in this example:
C:\DOCUME~1\Rodolfo>choice /c:12345 "Choose the output:"
Choose the…

rudicangiotti
- 566
- 8
- 20
-1
votes
2 answers
What am i doing wrong using the Choice command with batch?
This is not the full code, since its about 1000 lines long, but here's the problem, when i come to this section of the game
choice /c abc1 /n
when i press "a" it's supposed to "medicalbag" and instead it acts like if i were to press "1" and goes…

Kevin Løfgren
- 49
- 6