# Newbie questions about the declarative syntax

9 messages
Open this post in threaded view
|

## Newbie questions about the declarative syntax

 Hello, all From some examples in the internet I have found that a mulitline Windows batch script in Jenkins may be called with this step: bat """    chcp 1251    c:\path\to\program.exe """ Where is this syntax documented with regard to:   1.  the backslash escapes, and   2.  the triple quoataion marks? Accoring to the steps reference, the bat' step can take many parateters, the first being script'.  How I invoke the bat' step with several parameters, e.g.: script' and returnStdout'? Where is the general specification of the declarative syntax?  I am somewhat confused because the documentation starts from specific examples. -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/20200814190016.e0ded0495c2baeb95826d477%40gmail.com.
Open this post in threaded view
|

## Re: Newbie questions about the declarative syntax

 I wrote: > bat """ >    chcp 1251 >    c:\\path\\to\\program.exe > """ The backslashes should be doubled:   c:\\path\\to\\program.exe Sorry for the typo. -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/20200814193627.932d3a0cb364bd94765a8d38%40gmail.com.
Open this post in threaded view
|

## Re: Newbie questions about the declarative syntax

 In reply to this post by Anton Shepelev Hi Anton,take into account that the declarative syntax (and in general Jenkins pipelines) are just a DSL (https://en.wikipedia.org/wiki/Domain-specific_language) heavily based on Groovy language (http://groovy-lang.org/index.html).So, many (really many) things you can do ... it's just Groovy language, like the one you asked.In fact, triple quote is documented at http://groovy-lang.org/syntax.html#_triple_single_quoted_stringAnd also many "command" like "bat" you mentioned in the email are just Groovy function and follow the Groovy rules about parameters and how you can call them.In the case of "bat" is you just pass one parameter is used as script, as you pass more than one you need to specify who is what:"bat script: "whatever", returnStout: true"I hope it helps to get you started on learning it.Cheers,Gianluca.Il giorno venerdì 14 agosto 2020 alle 17:12:40 UTC+1 Anton Shepelev ha scritto:Hello, all From some examples in the internet I have found that a mulitline Windows batch script in Jenkins may be called with this step: bat """ chcp 1251 c:\path\to\program.exe """ Where is this syntax documented with regard to: 1. the backslash escapes, and 2. the triple quoataion marks? Accoring to the steps reference, the bat' step can take many parateters, the first being script'. How I invoke the bat' step with several parameters, e.g.: script' and returnStdout'? Where is the general specification of the declarative syntax? I am somewhat confused because the documentation starts from specific examples. -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/406d5273-6d8d-4e50-aae1-5c0099226c1cn%40googlegroups.com.
Open this post in threaded view
|

## Re: Newbie questions about the declarative syntax

 In reply to this post by Anton Shepelev Backslash escape is because the parser needs to know you're not trying to "despecialize" the following character. By default \ *is* a special character. (E.g. "\to" would mean \t, which is a tabulation, then the letter o).So using \ because the second \, the parser just It's the same in Java, C AFAIR and probably most languages BTW.CheersLe ven. 14 août 2020 à 19:28, Anton Shepelev <[hidden email]> a écrit :I wrote: > bat """ >    chcp 1251 >    c:\\path\\to\\program.exe > """ The backslashes should be doubled:   c:\\path\\to\\program.exe Sorry for the typo. -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/20200814193627.932d3a0cb364bd94765a8d38%40gmail.com. -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CANWgJS4kLh5J%3D3hCCujHHq3wxqZuHy1LPXCNXbACYQq2%3DcZnoQ%40mail.gmail.com.
Open this post in threaded view
|

## Re: Newbie questions about the declarative syntax

Open this post in threaded view
|

## Re: Newbie questions about the declarative syntax

 In reply to this post by Baptiste MATHUS Baptiste Mathus: > Backslash escape is because the parser needs to know you're not > trying to "despecialize" the following character. By default \ > *is* a special character. (E.g. "\to" would mean \t, which is a > tabulation, then the letter o). > So using \ because the second \, the parser just > > It's the same in Java, C AFAIR and probably most languages BTW. I know about the purpose of escape characters, but -- until Gianluca's reply -- I didn't know where to look for their exact specification in the declarative syntax. -- ()  ascii ribbon campaign - against html e-mail /\  http://preview.tinyurl.com/qcy6mjc [archived] -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/20200816004427.58f8311de5e089ffa995cdea%40gmail.com.
Open this post in threaded view
|