Foros del Web » Soporte técnico » Sistemas Operativos »

Bat en DOS

Estas en el tema de Bat en DOS en el foro de Sistemas Operativos en Foros del Web. Hola a todos, Resulta que estoy haciendo un bat, el cual debe pedir al usuario que ingrese un nombre de un archivo, en win 2000 ...
  #1 (permalink)  
Antiguo 10/07/2008, 11:46
 
Fecha de Ingreso: julio-2008
Mensajes: 4
Antigüedad: 15 años, 10 meses
Puntos: 0
Bat en DOS

Hola a todos,

Resulta que estoy haciendo un bat, el cual debe pedir al usuario que ingrese un nombre de un archivo, en win 2000 me funciono perfect pero yo necesito que el bat corra en un pc con DOS version 7,0 y en esta version el comando set no admite el modificador /p para asignar la entrada de teclado a la variable, alguien tiene una solucion para esto???

Gracias a todos
  #2 (permalink)  
Antiguo 10/07/2008, 15:02
Avatar de dogduck  
Fecha de Ingreso: enero-2006
Ubicación: ¿Atlantida, Hesperides, Islas afortunadas?
Mensajes: 2.231
Antigüedad: 18 años, 4 meses
Puntos: 19
Respuesta: Bat en DOS

Por San Google!!!
Mirate: http://www.robvanderwoude.com/userinput.html
Cita:
MS-DOS
In the MS-DOS 3 days, a simple Yes/No question could be answered by changing to a temporary directory where two temporary batch files were located, Y.BAT and N.BAT.
Guess what happend if a user typed a completely different answer . . .

Since MS-DOS 6 we have CHOICE.COM (CHOICE.EXE in later versions), a much more versatile and reliable way to solve one character answers like Yes/No.

Unfortunately, the CHOICE command was discontinued in Windows NT 4 and later.
You may want to try my Poor Man's Choice instead, or use DEBUG to create REPLY.COM, as published in Microsoft Knowledge Base article Q77457: Accepting Keyboard Input in Batch Files.

There is another way to receive user input: COPY CON

The command:

COPY CON filenamecopies the user input on the command line to the file filename.
To stop entering user input, the user has to type Ctrl+Z (or F6), followed by the Enter key.

Many PC users and batch file authors (including myself), find this approach "less intuitive", to say the least. One would expect that pressing the enter key is enough, and once you find out it isn't, the previous line of input cannot be removed anymore.

The following trick uses ANSI to perform some key translation: the Enter key is translated to the F6 key followed by the Enter key. Thus only one line of input can be entered, and pressing the Enter key sends the input to the temporary file USERINP.TMP.

ECHO Enter some input, and press Enter when ready . . .
ECHO ←[13;0;64;13p
COPY CON USRINPUT.TMP
ECHO ←[13;13p
CLS
ECHO You typed:
TYPE USRINPUT.TMP
Note: The ← character is the Esc character, or ASCII character 27 (or 1B Hexadecimal).
It is a representation of the Esc key.
This Esc character is not to be confused with escape characters!
  #3 (permalink)  
Antiguo 10/07/2008, 17:27
 
Fecha de Ingreso: julio-2008
Mensajes: 4
Antigüedad: 15 años, 10 meses
Puntos: 0
Respuesta: Bat en DOS

Amigo muchas gracias no sabes como me a servido esto....
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 07:03.