Set variables as an escape character using set /p?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Rafhack
Posts: 19
Joined: 23 Feb 2014 15:02

Set variables as an escape character using set /p?

#1 Post by Rafhack » 23 Feb 2014 15:07

I would like to catch escape characters like ctrl+z ctrl+a and so on. When we press these escape combination, the prompt shows ^Z ^A, but when I try to use them as a value to a variable, the code doesn't works.

set /p "input=> "
echo/%input%

The above code shows as output just %input% when I put an escape character, the variable is empty. So, is there a way to catch them? Or this isn't possible?

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Set variables as an escape character using set /p?

#2 Post by foxidrive » 23 Feb 2014 23:47

Have a look at this post by Aacini for an input tool that may help in your situation: viewtopic.php?p=32241#p32241

Rafhack
Posts: 19
Joined: 23 Feb 2014 15:02

Re: Set variables as an escape character using set /p?

#3 Post by Rafhack » 24 Feb 2014 06:09

foxidrive wrote:Have a look at this post by Aacini for an input tool that may help in your situation: viewtopic.php?p=32241#p32241


Thank you Foxidrive, I was looking for a method without third-part software, but GetInput.exe could help me well.

dbenham
Expert
Posts: 2461
Joined: 12 Feb 2011 21:02
Location: United States (east coast)

Re: Set variables as an escape character using set /p?

#4 Post by dbenham » 24 Feb 2014 08:56

jeb showed me a simple method that I used in my SNAKE.BAT game: viewtopic.php?p=27382#p27382


Dave Benham

Post Reply