1

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

I set my path on my windows slave like this: enter image description here

Then tried running this in a pipeline:

sh script: "echo sdfsdfsdf"

And I get error:

java.io.IOException: CreateProcess error=2, The system cannot find the file specified

EDIT: OK something weird is happening and I dont understand this behavior. I added "C:\Program Files\Git\usr\bin\" to the system path on the slave directly and restarted agent then this started working:

sh script: "echo sdfsdfsdf"

But this threw "cmd.exe" not found:

bat script: "echo sdfsdfsdf"

Then I removed the Path env from the slave and now BOTH work.

So that setting on the slave was doing something, what? I have no idea. Really like to just use that setting instead of having an external slave config like this.

red888
  • 22,770
  • 38
  • 161
  • 304

1 Answers1

0

Did you reconnect your agent after setting the path? This is required.

Furthermore: Not sure whether Jenkins understands Windows environment variables notation. Use ${Path};C:\Program Files\Git\bin

Joerg S
  • 4,110
  • 2
  • 18
  • 43