Click to See Complete Forum and Search --> : [RESOLVED] Input command in DOS


ViperZ2001
October 9th, 2001, 08:00 AM
Does anyone know how to easily get an input prompt from DOS? I can easily do it in Turbobat and then compile it, but I need to figure out how to do it in pure DOS.

TIA

------------------
GigaByte GA-7VTX, Athlon 1.4GHZ, 768MB PC2100 DDR memory, (2)40GB 7200 ATA100 IBM Deskstars, Hercules geForce2 GTS Pro II video with 64MB DDR, 21" Sony Trinitron, SBLive 5.1, Klipsch 5.1 sound system.....OH, wait, mine is a Packard Bell 133MHz. Never mind.

xt477
October 9th, 2001, 05:40 PM
theres noway to actully stop a batch file and prompt for user in put, without useing second party software. There was choice.com in DOS 6 that would prompt for numerical input or otherwise you had to use command line switches.

@echo off
if "%1"=="" goto _help
pkunzip * %1:\games
goto end
:_help
echo Please type install.bat c
end

So if the end user didnt type a drive letter he would be prompted to restart the batch file with proper letter.


------------------
Chaos reigns within.
Reflect, repent and reboot.
Order shall return.

Vernon Frazee
October 13th, 2001, 06:35 AM
Here's one way to get user input, via a BATch file, using nothing more than what comes with MS-DOS (and Windows 9x):
@echo off
:INPUT.BAT puts what is typed next in environment variable INPUT
set input=
echo INPUT.BAT
echo Type in something and press [Enter]
fc con nul /lb1 /n|date|find " 1: ">temptemp.bat
echo :Loop>>enter.bat
echo if not (%%input%%)==() set input=%%input%% %%5>>enter.bat
echo if (%%input%%)==() set input=%%5>>enter.bat
echo shift>>enter.bat
echo if not (%%5)==() goto Loop>>enter.bat
for %%x in (call del) do %%x temptemp.bat
del enter.bat
echo The string you just entered:
echo %input%
echo has been stored in an environment variable named INPUT
:End
Note: On the line that begins with fc con nul, there must be four spaces before the 1: and two spaces after it.

------------------
Moderator: VirtualDr.com (http://discussions.virtualdr.com/cgi-bin/Ultimate.cgi), Windows ME (http://discussions.virtualdr.com/cgi-bin/forumdisplay.cgi?action=topics&forum=Windows+ME&number=16&DaysPrune=10&LastLogin=) & Windows 3.1 and DOS (http://discussions.virtualdr.com/cgi-bin/forumdisplay.cgi?action=topics&forum=Windows+3.1+and+DOS&number=7&DaysPrune=10&LastLogin=) forums
Moderator: HelpFromTechs.com (http://www.helpfromtechs.com/cgi-bin/ubb/ultimatebb.cgi), Other Operating Systems (http://www.helpfromtechs.com/cgi-bin/ubb/ultimatebb.cgi?ubb=forum&f=6) forum