-3

So in this batch I want to make

set /p pv="2.1.5"
echo Program V : %pv%
set /p rn="0.0.1 [Initial Release] , 0.0.2 [Some Blah]"
echo %rn%
set /p rn2="1.1.3 [New Things, Bug Fix & Improvements] , [2.1.5 Stuff]"
echo %rn2%

but it won't work. The output is just

2.1.5
Program V
0.0.1 [Initial Release] , 0.0.2 [Some Blah] 
ECHO is off.
1.1.3 [New Things, Bug Fix & Improvements] , [2.1.5 Stuff]

My reason for using that is that when I need somewhere else to show the program version, I must not type all of that from the beginning, but I just put the

%pv% and %rn% or %rn2% ..

1 Answer 1

0

The answer is simple if you read the output of set /? carefully:

SET /P variable=[promptString]

The /P switch allows you to set the value of a variable to a line of input
entered by the user.  Displays the specified promptString before reading
the line of input.  The promptString can be empty.

Omit all the /ps from the set commands and be amazed. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.