Page 1 of 1

Menu question

Posted: 25 May 2011 00:53
by tebee
Probably already solved, how to set a default answer in menu? User should just hit enter to carry on (if he agree) or type what he wants, overriding the offered answer, and press enter.
Of course, no choice support...

Thanks

Re: Menu question

Posted: 25 May 2011 01:44
by orange_batch
Edit: Read next post.

Re: Menu question

Posted: 25 May 2011 05:15
by dbenham
Actually there is a simpler solution - the value of choice remains unchanged if <Enter> is pressed without entering anything:

Code: Select all

set choice=banana
set /p "choice=Pick your fruit (default=%choice%): "
echo:Your choice is %choice%.


Dave Benham

Re: Menu question

Posted: 25 May 2011 07:36
by orange_batch
...I knew that. :shock: I was drunk (really) lol. I use a choice function I wrote 8 months ago exclusively now, so it was in the back of my mind. 8)