Questions tagged [batch-choice]

27 questions
10
votes
1 answer

Batch file 'choice' command's errorlevel returns 0

I'm trying to create a batch file that performs different 'choice' command based on the version of Windows being executed on. The choice command's syntax is different between Windows 7 and Windows XP. Choice command returns a 1 for Y and 2 for N.…
ForgetfulChimp
  • 173
  • 2
  • 2
  • 7
3
votes
2 answers

How to save user input from CHOICE command to a variable to be used later in the errorlevel

I have a dynamic list of choices for a program I'm writing. I have it working correctly so that it will change the CHOICE options based on the count variable but now I'm struggling with making the errorlevel dynamic as well. Here is my…
Excallypurr
  • 319
  • 1
  • 16
3
votes
3 answers

How to use special characters in choice command - Batch File

I would like to add special characters like < | into my choice command, how can I do that? Here's my old code: CHOICE /C ABCDEFGHIJKLMNOPQRSTUVWXYZ0134567928 /N /M "Press 8 ...." and I would like it to be something like : CHOICE /C…
user6250760
2
votes
1 answer

how to delay choice (batch) in under a second?

Is there any way you can delay the choice command (in batch) in under a second? for example if i want to make a game where you can move around, and you have some enemies you have to fight, the enemies will not move that fast (they'll just move each…
user4739322
1
vote
1 answer

Use data from a .csv file as input to choice command in batch file

I have a simple batch to write to C:\Program Files (x86)\Data\ori.csv file the folowing information: division, originator name @echo off CHOICE /C NS /M "Please Choose Division:" echo. if errorlevel 1 set division=A8-NN if errorlevel 2 set…
Chris Evan
  • 25
  • 4
1
vote
3 answers

batch choice command will not work

I have this question about why this choice command won't work. I've looked on this site and compared all my scripting and I just can't figure out why it won't work http://www.computerhope.com/issues/ch001674.htm @ECHO OFF :START echo 1 to quit or 2…
Juggler
  • 51
  • 1
  • 10
1
vote
1 answer

Batch ERRORLEVEL not working properly

I've been using batch for a while now and I just recently ran into a problem I never encountered before involving ERRORLEVELS. Here is a short program I made to show off the error. @echo off title Choices CMD /C EXIT 0 echo [1] Choice 1 echo [2]…
RSher
  • 13
  • 1
  • 4
1
vote
2 answers

Batch file: = was unexpected at this time

Recently I've encountered yet another problem in my Batch file. Where I want something to be performed, I'm getting the following error: = was unexpected at this time. I've had this error before, however it's always due to a small mistake which I…
user2960215
  • 43
  • 1
  • 4
1
vote
1 answer

Batch File 'Choice' syntax

I have recently just worked on editing a script I saw to make it more dynamic and small. I seem to have found a problem which I can't figure out. For input it has a Choice script which allows only A-Z + 0-9, so I was wondering, what are the keys…
MrIllegal
  • 13
  • 4
0
votes
2 answers

Batch choice command runs both choices instead of just the one I selected

I am really confused with this problem. I'm trying to write a power plan switcher (because my laptop seems to have a issue with it constantly resetting to power saving for no reason) and I've got the choice prompt to work. Both pieces of code work…
0
votes
0 answers

How to input extended ASCII as default /d in choice command - batch file

I am creating a program that needs to countdown seconds. I used the choice command with /t 1 and /d to do that and also need to check if the user pressed any button on the keyboard. I've got a problem here because I cant pass any non-keyboard…
matheo9
  • 31
  • 2
0
votes
1 answer

batch file choice command when more than 10 number

I just want to list all my Interface Network and choose one. BUT, I have more than 10 Interface (12 actually) and then got an error. Cannot make then a choice How can I use ABCDEFGHIJKLMNOPQ... in place of 12345678... Here is my code : ''' @echo…
Jul Pandoa
  • 15
  • 3
0
votes
2 answers

Variables in batch

I am trying to create a code that can process a variable based on a choice in a way like this: set item1=ring set item2=deadhead set item3=bloodstainedmap set item4=strangebox cls echo 1) %item1% echo 2) %item2% echo 3) %item3% echo 4) %item4% echo.…
0
votes
2 answers

How to execute the choice command but not do anything

My batch script uses the choice command. And in my script I would want to check if choice.exe exists because it is the application that has the choice command. And I know exactly how to do that. By executing the choice command and making it so that…
0
votes
1 answer

Batch file choice command more than 10 parameter

I have a batch script which founds which drive is carrying my folder (diskpart situation) and founding folder, then it lists the text files (for now its text) in that folder. Anyways the problem is while the batch is asking me to choose which one do…
cankut
  • 19
  • 7
1
2