- 1 year ago
How to define the variable and use in jenkins through windows batch command
Comment
1 / 1
To define a variable and use it in Jenkins through a Windows batch command, you can utilize the %
symbol to denote environment variables. Here's an example:
batch@echo off
set MY_VARIABLE=Hello, Jenkins!
echo %MY_VARIABLE%
In the example above, the set
command is used to define a variable named MY_VARIABLE
with the value "Hello, Jenkins!". The variable can then be accessed using %MY_VARIABLE%
. The echo
command is used to print the value of the variable.
In Jenkins, you can use a Windows batch command build step to execute the batch script. The batch script can include variable definitions, commands, and any other necessary operations specific to your Jenkins build.
Make sure to adjust the variable name (MY_VARIABLE
) and its value (Hello, Jenkins!
) to suit your specific requirements.