Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
How do I input a value using a batch file.
For example, In perl i would say$input = "";
similairly in a unix shell scrips I will sayread input;
MY QUESTION IS HOW TO ACHIEVE THIS IN MS-DOS
BATCH FILE?HOPE TO GET SOMETHING FROM U'R EXPERTISE.

In NT-kernel based systems, Windows NT/2K/XP, you can prompt to get a value to store into an environment variable coding:
Set /P MyVariable=Type in the value
where "Type in the value" is the string displayed at prompt. The characters typed are stored in MyVariable and then processed.
This is not accomplished in DOS-kernel systems, Windows 9X/ME, where some tricks are needed to simulate interactive input.
If you want to know more, type Set /? at command prompt and see the help.
I hope this helps.

lol I dont think he was asking for user input IVO other wise he would have said his perl code was $var = ;
but thats not what he asked. he wants to just know how to set the value of a variable. and to do so jut do "set myvar=(input here)
keep in mind sumantha that in order to get the variable to show you need to call it within "%" like
set greet=hello
echo %greet%hope I helped.

Yeah u'r right Nathan. I meant
$variable_name ="STDIN"
STDIN - within angled bracket's which I guess get's mistaken to be a HTML tag and since STDIN makes no sense in a HTML tag it did'nt show up.Coming to the topic I got gold of the "set /p" stuff. Thankzz guys. I could be banging some similair rudimental questions but have patience and pls do answer them.
Thanks again.

keep em comin. sorry i couldnt help i finally relized about 15 minutes later that if it didn't show up for me...
anyway i'm normally help full

Well.. i've had similar problems recently..
What i did was convert it by bat2com but there are some limitations in this..
The very huge is that it cannot chech conditions and goto loops accordingly... so i have to check condidiotns and make seperate different .com files files instead of labels !!
Whai i wann achieve here is that actually i pass password to zip files that get extracted.. even though i have concerted it into .com still if anyone opens it in hex, one can easily come to know that the text string after pkunzip -s"MYPASS" is my password..
How do i prevent this ???????????????
Any help is greately appreciated ..
Bye,
Jassi

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |