Unfortunately, Windows 7 (and I think Vista also) ignores the leading white space at the SET /P prompt. Whitespace includes space, tab, and non-breaking space (0xFF).
The solution is not intuitive, but it is simple. Just the prefix of your invitation with the backspace character (0x08). The code below programmatically defines a variable containing a backspace character. Then it is easy to include it in any proxy server if necessary.
@echo off setlocal ::Define a BS variable containing a backspace (0x08) character for /f %%A in ('"prompt $H & echo on & for %%B in (1) do rem"') do set "BS=%%A" echo x 1. Enter x echo x 2. Leave x echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxx echo: set /p Menu=%BS% Enter number {1,2}:
Usually the backspace will make the linear cursor maintain one position, and then the next character will overwrite what was there. But since the prompt always starts from the first position, there is no room for backup. Backspace effectively does not accept anything, allowing you to fill a space in the tooltip :-)
You can put another character in front of the backspace if you want, but you don't need it. Backspace will return the line cursor up one position, and then your requested prompt will overwrite the unwanted character.
set /p Menu=x%BS% Enter number {1,2}:
EDIT. Here is an explanation of the FOR /F line that defines the BS variable
The PROMPT command controls text that appears as a prefix for each line of output when ECHO is enabled. By default, this is the current directory followed by the > character.
Using PROMPT $H invokes the <backspace><space><backspace> . Thus, a command of type REM will result in an output of <backspace><space><backspace>REM .
A line of commands is executed on one line. Typically, commands are not played if they are displayed on the same line as ECHO ON. An exception to this rule is any command that appears as part of a FOR DO clause. This is why the REM command is βexecutedβ in the FOR loop, so we get the output of the REM command.
The entire command line is executed in the outer FOR /F loop. The string is enclosed in single quotes to tell FOR /F to execute the command. Within single quotes, the string is enclosed in double quotes. Double quotes protect the command concatenation operator & . Normally, double quotation marks cannot include a command string. But it works in this case due to how FOR /F works. Commands are executed implicitly through the CMD /C "command string" . Therefore, in this case, double quotation marks are perfectly acceptable.
If double quotes are not used, the & characters must be escaped with ^ :
('prompt $H ^& echo on ^& for %%B in (1) do rem')
Finally, since the default FOR /F DELIMS is <tab><space> , the output of the REM command will be processed in tokens, and only the first token will be saved. The end result is a BS value consisting of a single <backspace> character.