我有一个接受字符串参数的程序。我创建了一个执行程序的批处理文件和一个多行字符串参数。我在多行字符串之后还有第二个参数。
C:\>MyProgram "This is a
multiline text" parameter2
当我运行它时,只有字符串的第一行包含在命令中,后续行和第二个参数将被忽略。有没有办法传递多行字符串参数?
最佳答案
您的问题与 - Windows: How to specify multiline command on command prompt?
In the Windows Command Prompt the ^ is used to escape the next character on the command line.
For example, (the More? being a prompt):
C:\>cd "c:\Program Files" ^
More? "\Common Files"
C:\>MyProgram "This is a " ^
More? "multiline text" parameter2
关于Windows 命令提示符 : How to pass multi-line string parameters,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11948025/