Search code examples
batch-filejenkinsjenkins-pipeline

When calling batch script inside Jenkins file doesn't get the values after asterisk


When calling a batch script inside Jenkins file it doesn't catch/read the value after asterik *.

Below are the few lines of my batch code:

SET HOUSE=GREENVILLA
SET NUMBER=10
SET HOUSE_NAME=%HOUSE%-%NUMBER%.*.y

I only see that HOUSE_NAME is set to GREENVILLA-10.*.y instead of GREENVILLA-10.44.6.y.

The actual path is \\servername\c\house\name containing the particular file greenvilla-10.44.6.y. I expect greenvilla-10.44.6.y being assigned to environment variable HOUSE_NAME.

Batch file coding is a new thing for me. I'm not sure about missing some basic things here.


Solution

  • solution was I have to replace/remove any extra characters(space,*), when passing an input. I had a special character(") passed in with the number,where batch thought thats the end of the path and didn't give me the other values. used Inputval = Inputval.replaceAll("\\W", "") before passing the value to the batch script in jenkinsfile.