如何将带引号的管道字符传递给 cmd.exe? [英] How to pass a quoted pipe character to cmd.exe?

查看:27
本文介绍了如何将带引号的管道字符传递给 cmd.exe?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想调用:

"c:(...)devenv.com" foo.sln /build "Debug|Win32"

使用 cmd.exe.根据我的经验, cmd.exe 要么去掉第一对引号(导致找不到可执行文件),要么去掉第二对引号(导致管道字符被误解).如何将带引号的管道字符传递给 cmd.exe?

using cmd.exe. In my experience, cmd.exe either strips out the first pair of quotes (causing the executable to not be found) or the second pair of quotes (causing the pipe character to be misinterpreted). How do you pass a quoted pipe character to cmd.exe?

推荐答案

你可以按照你在那里做的方式来做,用引号将 | 括起来.

You can either do it the way you are doing there, enclosing the string with the | in quotation marks.

或者你可以用 circumflex 重音来转义它 ^:

Or you can escape it with the circumflex accent ^:

"c:(...)devenv.com" foo.sln /build Debug^|Win32

附带说明:为什么要使用 DevEnv 而不是 MSBuild 来构建它?

As a side note: Why are you building this with DevEnv instead of MSBuild?

这篇关于如何将带引号的管道字符传递给 cmd.exe?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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