Interactive Menu with user Input

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
chondro
Posts: 6
Joined: 19 Mar 2015 09:43

Interactive Menu with user Input

#1 Post by chondro » 19 Mar 2015 09:51

Hi,
I am new the the forum as well as being new to batch scripting and I am looking for an answer on the best way of passing in user input to a command.
So the menu needs to ask the user to input a filename, then I need that result passed into the code below, the result will be the "end user" naming there own file to whatever they want and the process taking place. This takes place of me statically naming the file to what I want, the user can name it to what they want, then the rest of the process takes place and they have there own named file.

Any assistance and or example on the best way of doing this would be great, thanks in advance.

Sebastian.

Matt Williamson
Posts: 82
Joined: 30 Dec 2013 10:16
Location: United States by the big waterfall

Re: Interactive Menu with user Input

#2 Post by Matt Williamson » 19 Mar 2015 11:26

Open up a cmd prompt and type set /? pay particular attention to the /p switch. This allows your script to take input while it's running.

chondro
Posts: 6
Joined: 19 Mar 2015 09:43

Re: Interactive Menu with user Input

#3 Post by chondro » 24 Mar 2015 10:29

Matt,
Thanks for the reply, I have been working though this. My next question would be if the user put in a response to my question by me using the
below.
set /p Var1= " "

How then would I pass this response to another part of the batch file to then my ultimate command would get executed all based on the users input to the above, or would my VAR1 "" be totally inaccurate?

Thanks for the help!

chondro
Posts: 6
Joined: 19 Mar 2015 09:43

Re: Interactive Menu with user Input

#4 Post by chondro » 26 Mar 2015 16:20

I answered my own question and took care of this.. Thanks

Post Reply