- As shown in the figure below: I have generated two local variables in the bat script inserted in ① (the variables will be destroyed after the bat script is executed), and my current requirement is that I will use these two in the following script or jenkins variables.
- So variables can be saved to a temporary file through the echo command
properties.properties
.
-
After execution, this file will be generated under the execution path of the current Job
properties.properties
.
-
Then in ②,
inject environment variables
, so thatproperties.properties
the key-value pairs in the file are registered as global variables of Jenkins -
Then in ③, I create a bat command again, which can access the variables created in ①, if there is no step ②, it cannot be accessed.