Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Batch file 如何逃离'&';命令提示符中的符号_Batch File_Cmd_Escaping_Ampersand - Fatal编程技术网

Batch file 如何逃离'&';命令提示符中的符号

Batch file 如何逃离'&';命令提示符中的符号,batch-file,cmd,escaping,ampersand,Batch File,Cmd,Escaping,Ampersand,如果你有这样的代码 set "CONTENT_LENGTH=24" & echo first=1&second=2&third=3 我想让回声通过&两种方法进行回声 转义字符 在Windows批处理文件中,它似乎是^字符,因此您只需在特殊字符前加一个^ 本页似乎涵盖了以下例外情况: 在OS X/Linux上,使用反斜杠:echo three\&four 将参数短语用引号括起来。 echo "three&four" 这应该适用于任何一个系统。echo first

如果你有这样的代码

set "CONTENT_LENGTH=24" & echo first=1&second=2&third=3

我想让回声通过
&

两种方法进行回声

转义字符

在Windows批处理文件中,它似乎是^字符,因此您只需在特殊字符前加一个^

本页似乎涵盖了以下例外情况:

在OS X/Linux上,使用反斜杠:echo three\&four

将参数短语用引号括起来。

echo "three&four"

这应该适用于任何一个系统。

echo first=1^&second=2^&third=3
刚刚找到它<代码>设置“内容长度=24”&echo first=1^^^和second=2^^^和third=3。我自己并没有使用单引号和双引号转义,可能是因为我使用的是管道。我用三重帽子来做这个