下午好,
我想使用CMD批處理文件將simpliest標記添加到文件中,但似乎雙引號會破壞聚會:如何使用命令提示符使用雙引號寫入XML標記echo命令
從其他StackOverflow的帖子我知道雙引號狀態機和^「(^作爲轉義字符)的用法,但我不能使它的工作:
在此我試圖(與他們的結果):
C:\>echo <tag variable="value"> // very naïve
The syntax of the command is incorrect.
C:\>echo "<tag variable="value">" // let's use quotes for delimiting the string
"<tag variable="value">"
C:\>echo "<tag variable=^"value^">" // let's use the escape character
The system cannot find the path specified.
C:\>echo "<tag variable=^"value^"> // what if the state machine is not switched back?
The syntax of the command is incorrect.
C:\>echo "<tag variable=^"value"> // desperate people do weird things :-)
"<tag variable=^"value">
我也做了一些測試使用逃生ch在標記字符<和>之前的字符(因爲那些在CMD中有它們自己的意義),但是也沒有好的結果。
首先將條目放入一個變量(set test="..."
)中並不能解決問題。
如前所述,我越來越絕望。我想要做的唯一事情就是將其寫入文本文件中:
<tag variable="value">
有人可以幫我嗎?
在此先感謝
你應該在你的文章(標題和正文)中用「CMD」代替「DOS」......我想你並不是真的在使用DOS,對嗎? – aschipfl
@aschipfl:完成。 – Dominique