Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

User input to environment variable??

Posted on 1999-07-08
16
Medium Priority
?
437 Views
Last Modified: 2013-12-28
I have altered a win98 bootflop for specific use.
What i would like is this:
When executing the autoexec.bat, i want a question to be asked (ex. Type which server you would like to connect to?:)
When the aswer has been typed, i would like the aswer to be assigned to a environment variable.
Is that possible at all (in dos prompt), or maybe someone has other suggestions to achieve that
0
Comment
Question by:mhartog
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 4
  • 2
  • +3
16 Comments
 
LVL 7

Expert Comment

by:KangaRoo
ID: 1673052
No.
Have witten a tool once for that, 16 bit Dos, will work as long as MSDos is supported
0
 
LVL 6

Expert Comment

by:kschang
ID: 1673053
it's not EXACTLY what you ask for, but there is a little CHOICE.COM in your WINDOWS/COMMAND directory. It will take a single letter (you can specify which ones it WILL take), and based on that, it'll set ERRORLEVEL to the corresponding letter. Then you can take that and do whatever you want with it...
0
 

Expert Comment

by:ajaylulia
ID: 1673054
You can create a menu.

using the Batch commands
and the Syntax is lie this

@echo off

Echo 1. Exectue 1st command.
Echo 2. Exectue 2st command.

Use Choice.exe stored in the \windows\command.

ans use the syntax used in that

I can send u the sample attachment as how to use that  batch file.
just send ur email ID.

Bye for now



0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 7

Expert Comment

by:KangaRoo
ID: 1673055
Fixed choice is possible too off course.

:loop
  echo To wich drive do you want to connect?
  echo   f:
  echo   g:
  choice /fg /n
  if errorlevel 2 goto do_g
  if errorlevel 1 goto do_f
  goto loop
:do_g
  REM Do Stuff
  goto end
:do_f
  REM Do Stuff
:end
0
 
LVL 1

Author Comment

by:mhartog
ID: 1673056
i mean kangaroo
could u mail me that tool
200 points if u will.......



Marco
0
 
LVL 7

Expert Comment

by:KangaRoo
ID: 1673057
What's your address?
It allows you to directly *edit* an environment variable.
0
 
LVL 1

Author Comment

by:mhartog
ID: 1673058
marco.den.hartog@simac.nl

Man ur the best.......if this works!
0
 
LVL 7

Expert Comment

by:KangaRoo
ID: 1673059
Don't have it at work apparently, have to bring it in from home :(
0
 
LVL 1

Author Comment

by:mhartog
ID: 1673060
no prob
what time do u have over there?
0
 
LVL 7

Expert Comment

by:KangaRoo
ID: 1673061
10:55 AM
0
 
LVL 7

Expert Comment

by:KangaRoo
ID: 1673062
;)
0
 
LVL 7

Expert Comment

by:KangaRoo
ID: 1673063
Kijk eens naar Q.10111117
0
 
LVL 2

Accepted Solution

by:
femson7 earned 800 total points
ID: 1673064
Everything you type as long as it is not seperated with space gets assigned to %1 and anything that follows and seperated by a space gets assigned to %2 then %3 and so on.

if you type CONNECT TO AOL -->> Connect goes to %1 TO goes to %2 then AOL to %3.

I can make the batch file for you if you want... Although batch files are only for dos boxes only... although you can use it using .pif and invoke some apps on the windows platform.
0
 
LVL 1

Author Comment

by:mhartog
ID: 1673065
could u mail me a sample?
i can´t seem to get a prompt for input while running a batch file
should it be something like this:
@echo off
echo Type it ur name:
prompt $p$g
echo Ur name is %1
0
 
LVL 2

Expert Comment

by:femson7
ID: 1673066
errr AFAIK you can't assign a STRING to environment variables unless it is included as part of the command line. So what you normally do would be this:

create this and name it as connect.bat
@echo off
REM   if running the connection using windows use this part
REM   replace the app.exe with your program, provided that this progam
REM   can be used directly from the commandline and accepts commandline
REM   options
prompt $p$G
start [app.exe] %1 %2 %3
exit

@echo off
REM   if you will run it using a dos program use this part instead
REM   replace the app.exe with your program
prompt $p$g
[app.exe] %1 %2 %3


This is how you do it. You trick the user thinking he's being asked a question wherein fact it is the command prompt. Hehehe this is the part of the batch file

@echo off
prompt Please type connect <server name to connect to>; eg. connect aol [enter]

Hope this helps
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6873165
GREETINGS!

This question was awarded, but never cleared due to the JSP-500 errors of that time.  It was "stuck" against userID -1 versus the intended expert whom you awarded.  This corrects the problem and the expert will now receive these points; points verified.

Please click on your Member Profile and select "View Question History" to navigate through any open or locked questions you may have to update and finalize them.  If you are an EE Pro user, you can also choose Power Search to find all your open questions.

This is the Community Support link, if help is needed, along with the link to All Topics which reflects many TAs recently added.

http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
http://www.experts-exchange.com/jsp/zonesAll.jsp
 
Thank you,
Moondancer
Moderator @ Experts Exchange
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When asking a question in a forum or creating documentation, screenshots are vital tools that can convey a lot more information and save you and your reader a lot of time
Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

664 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question