I just have seen the same issue during upgrading Jenkins from version 1.644 to 2.40
Environment Injector Plugin was upgraded from 1.92.1 to 1.93.1
The problem is the following: When environment variable contains directory or file path with Windows slash as path separator, the injected value of the variable will be string without slashes.
Here is an example
Properties Content are set as following in the job config: see PropertiesContent.PNG
Corresponding fragment of the Console Output (see ConsoleOutput.PNG
) with result of injection.
The interesting thing is that "\target" became " arget" ( marked by yellow background).
It should be mentioned here that usage forward slashes is not supported in Windows batch commands and windows command prompt, so replacements back slashes to forward slashes not an option in Windows environment.
There is a related issue JENKINS-39131, which was set as "resolved". Unfortunately, such behavior makes Jenkins unusable in Windows environment: it is impossible to inject path related environment variables to any batch command or script where directory or file path is used!
The problem disappeared after downgrading back Environment Injector Plugin from 1.93.1 to 1.92.1
I really don't know what went wrong but now all works as expected - first thought there is a problem in the env inject plugin since it worked after downgrading from 1.93.1 to 1.93 but now also 1.93.1 works ...
I'm closing this for now, sorry for the noise.