pass parameter from jenkins parameterized build to windows batch command
Using Parameterized Build, you need to define parameters. The value of these will be prompted to you when you click "Build" link.
The name of the parameters should be a plain name, preferably without spaces, like Branch
. Do not add any ${}
or %%
to definition of the parameter name.
In the build steps, like Execute Windows Batch Command, you can reference the parameter with regular batch syntax, like %Branch%
.
If you would be on a *nix machine, you would use Execute shell build step and reference the parameter with regular bash syntax, like ${Branch}
Note that even when running on Windows, a lot of Jenkins plugins themselves take the parameters in *nix syntax, however the Execute Windows Batch Command will be batch-like, i.e. %Branch%
.
So, you can try typing:echo %Branch%
I also suggest putting just set
command on a line by itself, and it will show you all environment variables available to you during the build process, which is quite useful.