Dom*_*que 2 xml cmd escaping batch-file double-quotes
我想使用 CMD 批处理文件将最简单的标签添加到文件中,但双引号似乎破坏了聚会:
\n\n从其他 StackOverflow 帖子中,我知道双引号状态机和 ^" (^ 作为转义字符)的用法。但我仍然无法使其工作:
\n以下是我的尝试(及其结果):
C:\\>echo <tag variable="value"> // very na\xc3\xafve\nThe syntax of the command is incorrect.\n\nC:\\>echo "<tag variable="value">" // let\'s use quotes for delimiting the string\n"<tag variable="value">"\n\nC:\\>echo "<tag variable=^"value^">" // let\'s use the escape character\nThe system cannot find the path specified.\n\nC:\\>echo "<tag variable=^"value^"> // what if the state machine is not switched back?\nThe syntax of the command is incorrect.\n\nC:\\>echo "<tag variable=^"value"> // desperate people do weird things :-)\n"<tag variable=^"value">\nRun Code Online (Sandbox Code Playgroud)\n\n我还使用标签字符 < 和 > 前面的转义字符做了一些测试(因为这些字符在 CMD 中具有自己的意义),但也没有好的结果。
\n此外,首先将条目放入变量 ( set test="...") 中并不能解决问题。
\n如前所述,我变得绝望了。我唯一想做的就是将其写入文本文件:
<tag variable="value">\nRun Code Online (Sandbox Code Playgroud)\n\n有人可以帮我吗?
\n提前致谢
您想要转义的字符不是"而是<。
那么正确的语法是这样的:
C:\>echo ^<tag variable="value"^>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2886 次 |
| 最近记录: |