can someone explain what is happening
i can run this line
set /p Ques1=What is the question ?
and this one
set /p Ques1=What is the question ? /
as well as
set /p Ques1=What is the question ^? ^/
but not this
set /p Ques1=What is the question ^/ ^?
or this
set /p Ques1=What is the question / ?
when set /p see's a slash (and escaped as well) and then a question mark, it behaves like:
set /?
im trying to use it like so
set /p Ques1=What is your input [A/D/K/M/?] ^<D^>
but even escaping it does not work.
set /p Ques1=What is your input [A/D/K/M^/^?] ^<D^>
now the obvious workaround is to either put the ? in front of the slash or switch the slash for a comma or a dash or a backslash but im just curious as to the why SET behaves this way.
tt
A generic SET /P question
Moderator: DosItHelp
Re: A generic SET /P question
Code: Select all
set /p "Ques1=What is your input [A/D/K/M/?] <D>"
-
- Posts: 76
- Joined: 21 Dec 2011 14:21
Re: A generic SET /P question
Squashman wrote:Code: Select all
set /p "Ques1=What is your input [A/D/K/M/?] <D>"
Thanks S for that additional solution!
but that still doesn't answer the OP though? which is why does text, ^slash and then the ^question mark make SET loose it's mind and forget about the prompt before the escaped "slash" and "?", and act as though you had typed "SET /?"
is that as the programmers intended it to behave?
Re: A generic SET /P question
I could be wrong but I thought some one did a write up on SET /P a while back. I just know that putting the quotes in there preserves the special characters. So in essence if you are not preserving the special characters I would think that the SET command sees the /? as a command line argument.