Fatal error with Execute shell in project

Hey,
I have a problem:
When I create a project and click on “Build” and select Execute shell and build the project-
I got an error in the console output:

Started by user Rachel Cohen
Running as SYSTEM
Building in workspace C:\ProgramData\Jenkins\.jenkins\workspace\test_again
[test_again] $ sh -xe C:\WINDOWS\TEMP\jenkins1793137690508028130.sh
The system cannot find the file specified
FATAL: command execution failed
java.io.IOException: CreateProcess error=2, The system cannot find the file specified
	at java.lang.ProcessImpl.create(Native Method)
	at java.lang.ProcessImpl.<init>(Unknown Source)
	at java.lang.ProcessImpl.start(Unknown Source)
Caused: java.io.IOException: Cannot run program "sh" (in directory "C:\ProgramData\Jenkins\.jenkins\workspace\test_again"): CreateProcess error=2, The system cannot find the file specified
	at java.lang.ProcessBuilder.start(Unknown Source)
	at hudson.Proc$LocalProc.<init>(Proc.java:254)
	at hudson.Proc$LocalProc.<init>(Proc.java:223)
	at hudson.Launcher$LocalLauncher.launch(Launcher.java:997)
	at hudson.Launcher$ProcStarter.start(Launcher.java:509)
	at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:144)
	at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:92)
	at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:814)
	at hudson.model.Build$BuildExecution.build(Build.java:199)
	at hudson.model.Build$BuildExecution.doRun(Build.java:164)
	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:522)
	at hudson.model.Run.execute(Run.java:1896)
	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:44)
	at hudson.model.ResourceController.execute(ResourceController.java:101)
	at hudson.model.Executor.run(Executor.java:442)
Build step 'Execute shell' marked build as failure
Finished: FAILURE

The system cannot find the file specified
FATAL: command execution failed

If anyone knows what the problem is- it’ll help me a lot
thank you!
Rachel

That looks like you’re trying to run a ‘shell’ step on a windows node, which is unlikely to succeed, unless you have a specific shell executable installed there (in which case, it needs to be in the %PATH% of the node.

For windows nodes, you’d generally be looking at running either ‘bat’ or powershell steps for scripts.

Tony

1 Like

Thank you - It was help me a lot!