Reputation: 96
I am making batch animations, and to make nostrils I want to echo 2 carets, or ^^
, but only one is displayed.
How do I stop/bypass the escape property of the caret character?
Upvotes: 0
Views: 108
Reputation: 1870
Well technically, the caret ^
character is the escape character.
If you're wanting to display 2 carets, you can simply "escape the escape character".
The correct string to display 2 carets is below:
echo ^^^^
Upvotes: 5
Reputation: 14290
A couple of other ways to do this.
Use the FOR command.
for %%G IN ("^^") do echo %%~G
Use SET /P
with NUL
redirection. This one has some caveats. You can't put any spaces before the carets. If you need spaces before the carets there is another hack you can use with the backspace character.
<nul set /p ".=^^" &echo(
Upvotes: 3
Reputation: 34909
As an alternative to escaping the escape character (^^
), you could use delayed expansion:
rem // Assign variable with `^` protected by `""`:
set "STR=^^"
rem // Use delayed expansion which happens after escaping:
setlocal EnableDelayedExpansion
echo !STR!
Upvotes: 4
Reputation: 12804
You could double them up and get the result you are looking for.
echo ^^^^
Upvotes: 3