User input and variable? How?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Tami
Posts: 10
Joined: 31 Mar 2017 11:01

User input and variable? How?

#1 Post by Tami » 02 Apr 2017 00:16

So, here's my problem:

I want to ask in which language they need it. So they must decide between de, en, es and fr. How do i do that?
If they type in "de", then the %variable1% should be de. If they type in "en", then the %variable1% should be en.
Thanks!

aGerman
Expert
Posts: 4654
Joined: 22 Jan 2010 18:01
Location: Germany

Re: User input and variable? How?

#2 Post by aGerman » 02 Apr 2017 04:18

SET /P is what you're looking for.

Code: Select all

set /p "variable1=Enter the language [de, en, es, fr]: "

Steffen

UppityGaming
Posts: 1
Joined: 07 Apr 2017 09:00

Re: User input and variable? How?

#3 Post by UppityGaming » 07 Apr 2017 09:05

Well you could make separate sections in an array and use the following code
set en ==1 set fr==2
if %cho%==1 goto English
if %cho%==2 goto french

aGerman
Expert
Posts: 4654
Joined: 22 Jan 2010 18:01
Location: Germany

Re: User input and variable? How?

#4 Post by aGerman » 07 Apr 2017 11:46

That's the wrong syntax for SET. Also I don't see where the value for %cho% is coming from.

Steffen

Post Reply