how receive the input in the dos

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
eggPlant
Posts: 2
Joined: 16 Oct 2013 02:27

how receive the input in the dos

#1 Post by eggPlant » 16 Oct 2013 02:50

Code: Select all

@echo off
set /p input=please input a number:
set num1=%input%
set num2=123
if %num1% equ %num2% echo "="
if %num1% lss %num2% echo "<"
if %num1% gtr %num2% echo ">"
pause>nul

pure dos,not in the command(win),get error message on the line(set /p input=please input a number:),
i got the reason why error(in the dos,command 'set' have no /p),but i have no idea to modify the code,
nice guy can help me?

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: how receive the input in the dos

#2 Post by foxidrive » 16 Oct 2013 06:53

MS-Dos doesn't have an input command.

There is a dos method to get a y/n input, and Qbasic was often used to get input.

Another method was to use choice, to get one letter at a time and parse that.


If you describe the actual task then maybe we can help you.

eggPlant
Posts: 2
Joined: 16 Oct 2013 02:27

Re: how receive the input in the dos

#3 Post by eggPlant » 16 Oct 2013 08:33

foxidrive wrote:MS-Dos doesn't have an input command.

There is a dos method to get a y/n input, and Qbasic was often used to get input.

Another method was to use choice, to get one letter at a time and parse that.


If you describe the actual task then maybe we can help you.

thanks for your answer,i mean is,under the dos environment,i wanna have a script
that receive the key which i input,then decide if the key is gtr 123 or not.
show "=" means equal,">" means greater and so on.the script i paste is ok in the CMD,
just what my purpose.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: how receive the input in the dos

#4 Post by foxidrive » 17 Oct 2013 00:49

What version of MS-dos is this? Or what version of Windows?

Post Reply