Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

MS-DOS 6.22 Batch File User Input to Environment Variable

745 views
Skip to first unread message

Brian

unread,
Jun 4, 2008, 2:58:53 PM6/4/08
to
I need to take in user input (at the moment I am using copy con) with
a batch file and place it in an environment variable so other batch
files can access the user input. I can only use the standard commands
that come with MS-DOS 6.22. Does anyone have any ideas?

Timo Salmi

unread,
Jun 4, 2008, 3:37:54 PM6/4/08
to

FAQ
254761 Nov 11 2005 ftp://garbo.uwasa.fi/pc/link/tsbat.zip
tsbat.zip Useful MS-DOS batch files and tricks, T.Salmi,

All the best, Timo

--
Prof. Timo Salmi ftp & http://garbo.uwasa.fi/ archives 193.166.120.5
Department of Accounting and Business Finance ; University of Vaasa
mailto:t...@uwasa.fi <http://www.uwasa.fi/~ts/> ; FI-65101, Finland
Timo's FAQ materials at http://www.uwasa.fi/~ts/http/tsfaq.html

foxidrive

unread,
Jun 5, 2008, 3:33:39 AM6/5/08
to
On Wed, 4 Jun 2008 11:58:53 -0700 (PDT), Brian <brian.m...@gmail.com>
wrote:

@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

Brian

unread,
Jun 5, 2008, 9:58:42 AM6/5/08
to

For some reason the machine I have to work with does not have fc.exe.
Does anyone know where I can get one that will work on MS-DOS 6.22.

Herbert Kleebauer

unread,
Jun 5, 2008, 11:06:17 AM6/5/08
to

@echo off
echo BATCH_INPUT___hgQX-PPP_XPPP E#HH0E50EG0Ef0Ehs>myinput.com
echo myinput.bat hoAX5@@PZYh@xX5@D3!r/P[WX,b,-PZh>>myinput.com
echo X3!X2ErP,{,{PYX4=0ErWX,j,-PZh@@X3!=set input>>myinput.com

echo Enter your name:
myinput.com
call myinput.bat
echo.
echo Hello %input%
echo.

Brian

unread,
Jun 5, 2008, 12:25:53 PM6/5/08
to

I found another work that has worked for me. Thank you for your help

@This is the main batch file
@echo off
echo enter input followed by ctrl-z:
copy con usrinp.tmp
echo. >> usrinp.tmp
echo. >> usrinp.tmp
type usrinp.tmp | date | find "):" > usrinp.bat
call usrinp.bat
---------------------------------------------------
@support bat file named enter.bat
@echo off
if %2==date set usrinp=%4
-------------------------------------------------------

You can do some cleanup commands after calling usrinp.bat
The new environment variable will be usrinp

0 new messages