Home > Software design >  groovy function parameter in batch script
groovy function parameter in batch script

Time:12-15

i need to use a groovy function parameter in a batch script in a jenkinsfile. i tried several possibilities including everything listed here: https://gist.github.com/Faheetah/e11bd0315c34ed32e681616e41279ef4 , but i am not able to find a solution for accessing the content of the variable "example" in my batch script.

def function(example) {
...
bat label: '', script: '''@echo off
...
...
mkdir "some path\\"value of example"\\some additional path"
'''
...
}

is there any way to do this?

CodePudding user response:

It should work like this:

"""some path\\${example}\\some path""" 

Note: you are using single triple quotes in your example. This will not work and your variable will not be used. You need to use triple double quotes for that """

  • Related