批处理脚本中的符号 ^ 是什么意思? [英] What does symbol ^ mean in Batch script?

查看:44
本文介绍了批处理脚本中的符号 ^ 是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在这个命令中:

FOR/F %%A IN ('TYPE "%InFile%"^|find/v/c ""')DO SET "Till=%%A"

^ 是什么意思?

解决方案

^ 符号(也称为脱字符或抑扬符)是批处理脚本中的转义字符.使用时,下一个字符被解释为普通字符.

在您的脚本中,TYPE 命令的输出将作为 FIND 命令的输入写入.
如果在 | 之前不使用转义字符 ^,那么 | 的常规含义是 管道字符.

文档 说:><块引用>

要在使用 echo 时显示管道 (|) 或重定向字符(< 或 >),请在管道或重定向字符之前使用插入符(例如,^>、^< 或 ^|).如果需要使用插入符 (^),请键入两个 (^^).

In this command:

FOR /F %%A IN ('TYPE "%InFile%"^|find /v /c ""')DO SET "Till=%%A"

what does the ^ mean?

解决方案

The ^ symbol (also called caret or circumflex) is an escape character in Batch script. When it is used, the next character is interpreted as an ordinary character.

In your script, the output of the TYPE command to be written as the input to the FIND command.
If you don't use the escape character ^ before the |, then the regular meaning of | is a pipe character.

The Documentation says:

To display a pipe (|) or redirection character (< or >) when you are using echo, use a caret character immediately before the pipe or redirection character (for example, ^>, ^<, or ^| ). If you need to use the caret character (^), type two (^^).

这篇关于批处理脚本中的符号 ^ 是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆