Windows批处理:回显带有特殊字符的多行变量(Jenkins的Jira发行说明) [英] windows batch: echo a multi-line variable with special characters (JiraRelease Notes from jenkins)

查看:169
本文介绍了Windows批处理:回显带有特殊字符的多行变量(Jenkins的Jira发行说明)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Jenkins中使用JiraPlugin来生产ReleaseNotes,而我在Jenkins中的构建作业则使用批处理文件.

I am using the JiraPlugin in Jenkins to produe a ReleaseNotes and my build job in Jenkins uses batch files.

在执行的批处理文件中,当我仅发出set时,我可以看到在Jira发行说明中存在该变量.但这是多行,并且以#字符开头.

In the executed batch file, when I just issue a set, I can see that the varibale exists with the Jira Release notes. But it is multi-line and starts with a # character.

我的目标是做一个 echo %RELEASE_NOTES_JENKINS% > ReleaseNotes.txt

但是那是行不通的.我尝试在变量周围使用!!而不是%%,但这也不起作用.当我尝试回显变量时得到ECHO is off.. 同样,set确实显示了正确的内容:

but that never works. I tried using !! instead of %% around the variable but that also does not work. I get ECHO is off. when I try to echo the variable. Again, set does show it with the correct content:

RELEASE_NOTES_JENKINS=# New Feature
 - [XXXX-3525] Blahblahblah
 - [XXXX-3268] Blahblahblah
 - [XXXX-3119] Blahblahblah
# UNKNOWN
 - [XXXX-3545] [security] Blahblahblah
...

Jenkins在Windows 7服务器上运行. 这是Windows批处理(cmd.exe)所特有的,因为当Jenkins在Linux环境中运行时,仅将变量变量传递到文件即可.

Jenkins runs on a Windows 7 Server. This is specific to windows Batch (cmd.exe) since simply piping the variable to a file works when the Jenkins runs on a Linux environment.

关于如何进行这项工作的任何想法?

Any idea on how to make this work?

推荐答案

尝试

SET RELEASE_NOTES_JENKINS > ReleaseNotes.txt

而不是echo.

这篇关于Windows批处理:回显带有特殊字符的多行变量(Jenkins的Jira发行说明)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆