【问题标题】:How to not print a scaped quote如何不打印转义报价
【发布时间】:2018-02-19 19:21:42
【问题描述】:

我需要回显一个 html 字符串;

echo <html><body></body></html>;
result < it was unexpected

echo "<html><body></body></html>";
result "<html><body></body></html>";

我不想显示双引号;

echo ^<html^>^</html^>
result <html></html>

它对我来说很完美,但是字符串很大,如果我给所有字符加上 scape ,它将超过提示的限制大小;

注意,我无法将此字符串保存到文件中。

【问题讨论】:

  • 你的意思是逃跑吗?
  • 您可以使用set /P "=&lt;html&gt;&lt;body&gt;&lt;/body&gt;&lt;/html&gt;;" &lt; nul 后跟echo/
  • 谢谢@Aacini,你的方法奏效了。

标签: windows batch-file command-line cmd command-line-arguments


【解决方案1】:

我认为你可以使用带引号的 SET 命令:

SET "string=<html><body></body></html>;"

然后 ECHO 就可以了

【讨论】:

  • 如果您对可能在 html 文本中的任何引号进行转义,这可能会起作用。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-05-15
  • 1970-01-01
  • 2023-04-03
  • 1970-01-01
  • 2021-06-02
  • 2020-12-16
  • 1970-01-01
相关资源
最近更新 更多