Problem with build step - Windows Batch Command

3,409 views
Skip to first unread message

ssitara...@gmail.com

unread,
Feb 2, 2017, 11:39:29 PM2/2/17
to Jenkins Users
Hi

I have setup Jenkins in Docker and am able to run some ANT script, I now have to run some 'windows batch script'. I gave a basic command echo "Hello" but I am getting the following error... I believe it is expecting cmd.exe to be in my work space??? Can some one please help me resolve this ? Thanks in advance

[CI] $ cmd /c call /tmp/hudson5615964182226568321.bat
FATAL: command execution failed
java.io.IOException: Cannot run program "cmd" (in directory "/var/jenkins_home/workspace/CI"): error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at hudson.Proc$LocalProc.<init>(Proc.java:243)
at hudson.Proc$LocalProc.<init>(Proc.java:212)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:815)
at hudson.Launcher$ProcStarter.start(Launcher.java:381)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:95)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:64)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
at hudson.model.Build$BuildExecution.build(Build.java:205)
at hudson.model.Build$BuildExecution.doRun(Build.java:162)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
at hudson.model.Run.execute(Run.java:1720)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:404)
Caused by: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:247)
at java.lang.ProcessImpl.start(ProcessImpl.java:134)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
... 15 more
Build step 'Execute Windows batch command' marked build as failure
Finished: FAILURE

Thanks.




Daniel Beck

unread,
Feb 3, 2017, 2:51:18 AM2/3/17
to jenkins...@googlegroups.com

> On 03.02.2017, at 05:39, ssitara...@gmail.com wrote:
>
> I gave a basic command echo "Hello" but I am getting the following error... I believe it is expecting cmd.exe to be in my work space???

Windows batch scripts need to run on Windows nodes -- as you can see from the workspace path, it's a Linux system.

ssitara...@gmail.com

unread,
Feb 3, 2017, 3:33:41 PM2/3/17
to Jenkins Users, m...@beckweb.net
Hi,

I got you. Thank you so much for your help.

Sitaram.

vikash singh

unread,
Dec 20, 2017, 11:16:13 AM12/20/17
to Jenkins Users
I am facing the same problem.
Can you tell me how did you resolve it.?
How can i change the workspace to run windows batch command.? 
 

Jorge Nuñez

unread,
Oct 30, 2018, 4:19:42 PM10/30/18
to Jenkins Users
You have to looking in your Jenkins Job if you´r using any step for "windows" and change it to a "shell"

Kirill Orlov

unread,
Dec 29, 2022, 8:31:45 AM12/29/22
to Jenkins Users
Hello! I'm having the same issue
Could you describe how you resolve the issue pls ?

пятница, 3 февраля 2017 г. в 23:33:41 UTC+3, ssitara...@gmail.com:

Nikolay Sorokin

unread,
Dec 29, 2022, 12:46:55 PM12/29/22
to Jenkins Users
You cannot run Windows scripts in Linux system and vice versa - the only solution is to use appropriate shell as conditional step.

Regards

Reply all
Reply to author
Forward
0 new messages