Tech Support > Operating Systems > MS-DOS > BAT file that takes user input...
BAT file that takes user input...
Posted by Jesse Gardner on October 22nd, 2004


..bat file Newb here, maybe you can help?

I want to write a .bat file that will ask for two strings to be entered
by the person running it. The only reason I don't want to use
"program.bat %1 %2" is because the person(s) using it aren't very
computer literate, and I want to make it is easy to understand as possible.

IE
The .bat file will ask:

Enter Username:
Enter New Password:


Then I wante to take the variables and execute a .exe with them in the
switches.


TIA!

Posted by foxidrive on October 22nd, 2004


On Fri, 22 Oct 2004 09:07:47 -0600, Jesse Gardner wrote:

For which OS?

Posted by Matthias Tacke on October 22nd, 2004


Jesse Gardner wrote:

wbat from Horst Schaeffer:
<http://home.mnet-online.de/horst.muc/>

Inp.com from Herbert Kleebauer ( win32 windows version required)
<http://www.google.com/groups?selm=41546117.39B56E65%40unibwm.de&output=g plain>

Conset from Frank P. Westlake ( Windows NT version required )
<http://gearbox.maem.umr.edu/batch/f_w_util/conset.zip>

And a whole bunch of similar tools. Use google to search for more.

--
Greetings
Matthias

Posted by Jesse Gardner on October 22nd, 2004


Windows XP or 2000

Thanks.



foxidrive wrote:

Posted by foxidrive on October 22nd, 2004


On Fri, 22 Oct 2004 09:42:37 -0600, Jesse Gardner wrote:

Look at the help on set

SET /?

for this style of syntax: set /p var=question:


Posted by Timo Salmi on October 22nd, 2004


Jesse Gardner <admin_deleteth1s@badcrc.com> wrote:
You asked word by word the same question in news:alt.msdos.batch.nt
(without specifying the platform). There NT/2000/XP is the default.
See my response in there for that gamut.

In the current newsgroup MS-DOS+Win../95/98/Me is the default. For
a solution see

40) A batch to put user input into an environment variable
147) Can I enter a password to batch without it being echoed?

250909 Oct 12 2004 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:ts@uwasa.fi <http://www.uwasa.fi/~ts/> ; FIN-65101, Finland
Timo's FAQ materials at http://www.uwasa.fi/~ts/http/tsfaq.html

Posted by Jesse Gardner on October 22nd, 2004


Thanks everybody for your help, the "SET /P" command worked nicely.



Timo Salmi wrote:

Posted by Timo Salmi on October 23rd, 2004


Jesse Gardner <admin_deleteth1s@badcrc.com> wrote:
Nice to hear that it worked, but SET /P is not part of this "set".
In MS-DOS+Win../95/98/Me one indeed has to use the other, more
complicated means.

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:ts@uwasa.fi <http://www.uwasa.fi/~ts/> ; FIN-65101, Finland
Timo's FAQ materials at http://www.uwasa.fi/~ts/http/tsfaq.html

Posted by Klaus Meinhard on October 23rd, 2004


Just a reminder that, under plain DOS, you don't need a bunch of
different utils for every need. The free command.com replacement 4DOS
handles most of them alone. In this case:

In minimal form:

:: MYBATCH.BAT
input Enter Username: %%un
input /p Enter New Password: //pw
a.exe /%un /%pw

Note that the /p switch tells the input command to echo asterisks, not
the actual characters to the screen.

--
Klaus Meinhard

Free 4DOS download: http://download.jpsoft.com/4dos/4dos.exe

4DOS Installation FAQ:
http://groups.google.de/groups?hl=de...ine.com&rnum=1



Posted by Richard Bonner on October 24th, 2004


Jesse Gardner wrote:

*** I have seen this done in DOS batch with the CHOICE command. However,
it can be made much easier via after market updated commands. If you want
to get XSET, in its documentation, it has a suggested log-in batch file
which uses its "/PROMPT" switch. It will ask the questions and place the
user's answers into variables.

XSET is shareware.

A link is in my "DOS Websites" directory at:

http://www.chebucto.ns.ca/~ak621/DOS/Websites.html


Richard Bonner
http://www.chebucto.ns.ca/~ak621/DOS/


Similar Posts