逃离与正斜杠和问号开始一个批处理文件回声 [英] Escaping a batch file echo that starts with a forward slash and question mark
问题描述
一个棘手的一个位。我怎样才能正确地逃脱在批处理文件下面?
Bit of a tricky one. How can I correctly escape the following in a batch file?
echo /? display this help text
这特殊的字符组合被视为一个ECHO /?命令:
This particular combination of characters is treated as an "ECHO /?" command:
C:\Batch>ECHO /? display this help text
Displays messages, or turns command-echoing on or off.
ECHO [ON | OFF]
ECHO [message]
Type ECHO without parameters to display the current echo setting.
这不响应符号(^)逃逸,即我试过^ /? / ^?和^ / ^?
It does not respond to caret (^) escaping, ie. I've tried ^/? /^? and ^/^?.
注意:作为解决办法,我发现,足以绕过ECHO命令行处理器之间插入其他字符如:
NB: As a workaround, I found that inserting other characters in between is enough to bypass the ECHO command line processor, eg:
echo ... /? display this help text
不过,这是不理想的,我想知道是否有到acheive所需的输出,即用/办法?在回应消息的开始。
Still, this is not ideal and I wondered if there was a way to acheive the desired output, namely with /? at the start of the echoed message.
推荐答案
有关逃脱回声参数,则可以使用替代语法回声
:
For escaping echo arguments, you can use the alternative syntax echo.
:
echo./?
这篇关于逃离与正斜杠和问号开始一个批处理文件回声的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!