Issue
I am trying to run a batch file from Jenkins but I can't get it to run. In the pre-build step I have entered the file I want to execute but I get the stacktrace shown below. Jenkins doesn't recognize the cmd command.
How can I fix this?
Solution
Your Linux Jenkins slave doesn't support cmd. In order to workaround it you have several options (from better to worse):
- Add a Windows slave to Jenkins and run cmd from there.
- Port your batch file to bash or similar and run it from your Linux Jenkins slave.
- Add some kind of DOS emulator (Wine, DOSBox, DOSemu) in your Linux Jenkins slave.
My advice: If you know Linux & Bash or you have no control of Jenkins go for option 2. Otherwise go for option 1. Avoid option 3.
Answered By - Oscar Foley