假设这是一个批处理文件。
call :SomeFunction "a string with an > arrow"
goto:eof
:SomeFunction
echo %~1
goto:eof
这将会输出:
call :SomeFunction "a string with an > arrow" echo a string with an 1>arrow goto:eof goto:eof
并且将创建一个名为arrow
的文件,其中包含a string with an
。请注意1>
。
在这种情况下,我该如何防止命令处理程序解释>
作为重定向符号呢?(提示:我已经尝试过^>
,但不是这个方法。)
编辑:其他运算符(|
和&
)也受到影响。