首页 > 解决方案 > 如何在 Cmd 中回显大于号?

问题描述

如何在 cmd 中回显“大于”字符?我想转义“大于”符号 ( >),因为我需要它回显到另一个.bat文件。

Echo net session>nul 2>&1>>2nd.bat

我需要 2nd.bat 文件中的这个输出:

net session>nul 2>&1

如果我不使用引号,则会在提示窗口中显示残缺的输出。

我不能使用引号,因为如果我使用它们,我的 2nd.bat 中的输出将变为"net session>nul 2>&1"不运行。

标签: batch-filecmdescapingdosbox

解决方案


答案很简单。

您尝试了什么(评论的结果):

echo net session^>nul 2^>^&1>2nd.bat

我尝试过的(有效的):

echo net session^>nul 2^>^&1 >2nd.bat

推荐阅读