forward slash, and an optional text string following an open bracket.
I am attempting to work through all the special characters by changing them to something else,
then changing back to the original character, used as a literal in the text string, after it has been
determined that the entry is in fact a text string (because of the opening bracket). Entry
exceptions: a caret is required with the ampersand, and %% is required to display a percent symbol.
I am trying to get the %%, entered for a literal % character, converted to an unused character while the command
line string is being tested, then after it has been determined that a text string has been entered, convert it
back. Is this possible? The code below does not work but it shows the conversion logic.
Code: Select all
@Echo Off
setlocal enabledelayedexpansion
set "str=50%% off"
set "str=%str:%%=ò%"& rem change percent to character for ascii code 149
echo str after 1st convert: %str%
echo do some stuff with str...
set "str=%str:ò%=%%"& rem change character for ascii code 149 to percent
echo str after 2nd convert: %str%