How to set the PATH environment variable in Jenkins configuration on Windows?

The issue I had was caused not by a wrong Path configuration. %PATH%;D:\path\to\COMPOSER_HOME\vendor\bin is correct.

enter image description here


don't get to confused about %PATH% vs $PATH in the Value field. While %PATH% is the correct syntax for windows nodes, you should use /foo/bar:$PATH to extend PATH on unix nodes


I had a similar requirement to customize Path variable on a Windows slave with a Windows Jenkins master. I did not want to create a Jenkins global environment variable and wanted this variable to be specific to a particular windows node/agent.

Here is what I did:

1) Created an Environment Variable as shown below in Nodes -> WindowsNode -> Configure screen:

Nodes -> WindowsNode -> Configure

2) Disconnected my Jenkins node.

3) Restarted my Jenkins system process directly on the slave.

4) Tested it out by clicking on Nodes -> WindowsNode -> System Information and saw the new environment variable assigned to the node:

enter image description here

5) Then used it in a Jenkins job that would run on the Windows slave/agent by adding below command to an Execute Windows Batch Command build step:

git --version


It needs to be "Path", not "PATH".

Jenkins treats this special variable in a case-sensitive way, and only "Path" is recognized as being the path variable. "PATH" looks to jenkins like a generic environment variable, even on Windows.