When I run my build process on Windows Server 2008, it fails with the error message like
Cannot run program \"foo\": CreateProcess: error=2, The syste
If you want to set it locally for the respective job try this in Build -> Execute batch Command
step:
//append more variables separated by ; if required
SET Path=%PATH%;C:\Program Files\Git\bin;
//run your command here
git --version
This approach works for any type of command you wanted to execute. Just add the respective environmental variable to the Path variable locally as shown above.
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
For adding path for Slave nodes, like home env variable.
It can be directory done from Slave nide configuration.
Open the configuration setting for any slave node, add env vaiable information.
For example for setting HOME just add the name and location of home directory.
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.
Couldn't get other it to work by the other answers. Ended up setting the variable in my slave node launcher (batch) script:
SET PATH=C:\cygwin64\bin;%PATH%
java -jar agent.jar -jnlpUrl ...
The issue I had was caused not by a wrong Path
configuration. %PATH%;D:\path\to\COMPOSER_HOME\vendor\bin
is correct.