简体   繁体   English

使用Windows批处理文件将带有特殊字符的多行放入剪辑

[英]Put multiple lines with special characters into clip using windows batch-file

So, currently I've tried to do it like this: 所以,目前我试图这样做:

@echo off
(
    echo <script type=&quot;syntaxhighlighter&quot; class=&quot;brush: csharp&quot;><![CDATA[
    echo ]]></script>
) | clip

I also tried to encapsulate each line with "", but this way quotes are printed too. 我还尝试用“”封装每一行,但这样的引号也被打印出来。 Putting ^ character before each of the special characters seem to break the script completely. 在每个特殊字符之前放置^字符似乎完全破坏了脚本。 Like this: 像这样:

echo ]]^>^</script^>

You may use this method: 您可以使用此方法:

@echo off
< NUL (
    set /P "=<script type=&quot;syntaxhighlighter&quot; class=&quot;brush: csharp&quot;><![CDATA["
    echo/
    set /P "=]]></script>"
    echo/
) | clip

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM