XP-compatible Choise-script - User-input friendly batch-example

Convert your BATch files into EXEcutable format in one click.
Post Reply
Joaquin
Posts: 2
Joined: Tue Feb 28, 2006 8:55 pm
Location: Medellín - Republica de Colombia

Post by Joaquin » Sun Mar 12, 2006 12:06 pm

In the Help-file of Quick Batch File Compiler you talk about an
"XP-version" of the CHOICE-command script?!? I'm new in here and that's
maby the reason that I couldn't find it...mmm
..but if someone have interest, I post one in here.

---------------------------------------------

@echo off
Setlocal Enableextensions Enabledelayedexpansion
Title a Choice alt. for Win-XP by J. DeServantes in 2005
:inicio
cls
:otravez
Echo.
Echo. type 1,2 or 3...
Echo.
set choice=
set /p choice=...then press Enter to continue.
set deci=You pressed the key
if not '%choice%'=='' set choice=%choice:~0,1%
if '%choice%'=='1' set no=One & goto contesta
if '%choice%'=='2' set no=Two & goto contesta
if '%choice%'=='3' set no=Three & goto contesta
if '%choice%'==' ' exit
Echo.
Echo. %choice% is not valid, try again! (...or space for exit)
goto otravez
:contesta
Echo.
Echo. %deci% %no%!
Echo.
Pause & goto inicio


----------------------------------------------
Copy and past, modify or enjoy...

Br. Joaquin form the sunny Colombia
----------------------------------------------

Post Reply