QUESTION :
I’m organizing my context menu for compiled binary tools and I wanted to use an ampersand (&) in one of the labels but nothing I have tried seems to work. I don’t alter strings in the regisrty often and trying some of what I already know has not worked so far. I have tried the following:
^&
&
\&
@"Obfuscation & Packing"
&
I’m not clear on what form of syntax the registry uses, it seems to be it’s own thing compared to everything else I have worked with. How do I properly escape this character in a registry string?
ANSWER :
REG_SZ strings are just strings. They don’t have anything that needs escaping.
Menu items are where the &
character becomes special. In menu item titles, it indicates that the following letter will become the keyboard shortcut (mnemonic) – e.g. Ob&fuscation
will make the F key select the menu item, and the letter f
will be underlined.
To escape the ampersand in menu items, it has to be doubled, e.g. Obfuscation && Packing
.