How can pass Hudson/Jenkins parameters to windows batch command

34,938

Solution 1

Execute your Batch file as like the below

Deploy.cmd -configuration=%DEPLOYCONFIGURATION% -source=%DeploySource%

In case your Jenkins server run in unix/ Linux machine use "export" command to set environment variable for windows use "set" command like the below

For Windows:

set DEPLOYCONFIGURATION=DEV
set DeploySource=c:\myFolder

For Unix:

export DEPLOYCONFIGURATION = DEV
export DeploySource=c:\myFolder 

Hope it might solve your issue.

Thanks, Madhan

Solution 2

Use %DEPLOYCONFIGURATION% instead of ${DEPLOYCONFIGURATION} in windows batch command

Share:
34,938

Related videos on Youtube

davdomin
Author by

davdomin

I am a web developer, software engineer, and writer currently living in Lima, Perú. My interests range from programming to writing. I am also interested in technology, sports, and reading.

Updated on March 12, 2020

Comments

  • davdomin
    davdomin about 4 years

    well i need to execute a batch file in my Hudson Job, I have a parameter(Jenkis parameter) and i need to pass this value like param to batch file, i tried this:

    Deploy.cmd -configuration=${DEPLOYCONFIGURATION} -source=${DeploySource}
    

    My Deploy.cmd is configurated for get this values but Jenkis doesn't assign the values.. For example, i have this:

    ${DEPLOYCONFIGURATION} = DEV
    ${DeploySource} = c:\myFolder
    

    Then,the batch file take this values

    %DEPLOYCONFIGURATION% = ${DEPLOYCONFIGURATION} 
    %DeploySource% = ${DeploySource}
    

    Takes the parameter name not its value

  • SandBag_1996
    SandBag_1996 over 8 years
    Is there a way to change the value of DEPLOYCONFIGURATION in windows batch command?