visitor (0 QPoints)
  • FR
  • EN
  • NL
  • DE
  • ES
304 experts, 1182 utilisateurs inscrits, 1626 questions déjà répondues
European Experts Exchange, le meilleur site pour des solutions de qualité

New Improved Search!

 


Le lien vers le DDRK est de nouveau fonctionnel.
Nous avons subi une coupure d'une semaine, désolé.
(23-30/01/2010)

Systèmes d'exploitation :: DOS :: dos get input


Par : Bernard France  Date : 21/11/2005 09:32:54  Anglais  Points: 20 État : Répondue
Qualité : Excellente
how to get input in DOS ?
Par : VGR Date : 21/11/2005 09:52:01 Anglais  Type : Réponse
Yo

there are classical answers to this classical problem.

In the times of NT4 and before, when you had either the NT 32bits "kernel" or the true DOS operating system, you had to use add-ons or external programs built for this (Turbo-Pascal, C, whatever) and play with batches-calling-batches-returnvalue-branch etc

One example of those marvelous add-ons is "dos4nt", a 209 KB application doing marvelous things :

[] d:\dos4nt>?
? ACTIVATE ALIAS ATTRIB BEEP BREAK
CALL CANCEL CD CDD CHCP CHDIR
CLS COLOR COPY DATE DEL DELAY
DESCRIBE DETACH DIR DIRS DO DRAWBOX
DRAWHLINE DRAWVLINE ECHO ECHOS ENDLOCAL ERASE
ESET EXCEPT EXIT FFIND FOR FREE
GLOBAL GOSUB GOTO HELP HISTORY IF
IFF INKEY INPUT KEYBD KEYS LIST
LOADBTM LOG MD MEMORY MKDIR MOVE
MSGBOX ON PATH PAUSE POPD PROMPT
PUSHD QUIT RD REBOOT REM REN
RENAME RETURN RMDIR SCREEN SCRPUT SELECT
SET SETDOS SETLOCAL SHIFT SHRALIAS START
TEE TEXT TIME TIMER TITLE TYPE
UNALIAS UNSET VER VERIFY VOL VSCRPUT
WINDOW Y


Where the interesting parts are INPUT, INKEY, TEE etc etc

Examples of "solutions" available when NOT using add-ons are to be found there

an other ugly one is : (dtech10)
this is because Win2K has NO LONGER the CHOICE.EXE (former CHOICE.COM) of MSDOS 6+ any more.

@echo off set /p Input= if /i "%Input%"=="y" (goto Proceed) exit /b :Proceed echo Proceed or this if /i not "%Input%"=="y" (exit /b) rem Here if Input=y/Y echo Proceed



Nowadays, starting with Win2K (NT5.0) there are built-in solutions but they may involve uglier things like "windows scriptiong" (VBS, dangerous and unsecure) :

echo wscript.quit wscript.stdin.readline> ~userin.vbs echo Please enter a number cscript.exe //NoLogo //B ~userin.vbs echo You entered %errorlevel% del ~userin.vbs



I also read that this could work in most Zindoze flavours (MSDOS6+) except Win2K :

choice Do you want to proceed? if errorlevel 2 quit rem hereafter the rest of your batch commands



Finally, there is kind of a nice summary on this page

have fun ;-)

Inscrivez-vous pour répondre

 Add This Article To:
 del.icio.usDel.icio.us  diggDigg  googleGoogle  spurlSpurl
 blinkBlink  wongWong  simpySimpy  yahooY! MyWeb 
EContact
browser fav
page générée en 56.135180 millisecondes

Why Google AdSense ads ?

compteur
 Ranking-Hits PageRank for this page