Why does my Jenkins not run a .exe file?

3,365 views
Skip to first unread message

Balu Pillai

unread,
Mar 20, 2019, 9:00:25 AM3/20/19
to Jenkins Users
Hi all, 

I am a newbie to Jenkins, but I have been reading and learning a lot in the recent months. First of all, let me say - I am very impressed with Jenkins and that how most of the stuff work out of the box for simple configurations. I have been pushing my self gradually into writing pipeline scripts etc. I am blocked with a few issues, one of them being that I am not able to run a windows executable from my Jenkins. Below is what I face: 

Issue:
- Jenkins gets stuck/frozen when running an .exe in a batch script (both freestyle and pipeline) - tried with many .exes to test and the same.
.

Info:
- The executable is a binary file generator app installed locally on the machine. It takes in few parameters and creates a binary file
- I am able to run it outside of Jenkins and works as expected
- Jenkins v2.152 is installed as localhost and the .exe is also on this machine (no slaves configured)
- I have no admin access on the machine. But Jenkins is installed on C: drive with admin privileges and can modify files in work space.
- It is a windows 10 machine.

My attempts:
1. As some have suggested I have tried to run .exe as a service by using the keyword "start", but this time Jenkins does not freeze but the executable does not run.
2. Used Java melody etc. to analyse if there is an issue with Jenkins resources. No problem, enough resources left
3. Installed and used the plugin "Windows exe runner", but have the same issue.


I would appreciate if any advise or some pointers can be given to me to progress. So many thanks.

Regards,
Balu

Aaron Digulla

unread,
Mar 20, 2019, 9:59:06 AM3/20/19
to Jenkins Users
Hi Balu,

This is very weird. Some things that you can try:

- Run another exe (something simple). Does that work?
- Does it work when you put "cmd /c" in front of the name of the executable?
- Do you get an error when you add a typo to the name of the executable (maybe Jenkins can't find it)?
- Does the program wait for input on stdin? Try to close stdin (not sure how do that on windows, on Linux, it would be "< /dev/null")
- Does the master get stuck (i.e. the web interface doesn't respond anymore) or the slave?

Regards,

--
Aaron Digulla

Mahmoud Beltagy

unread,
Aug 18, 2021, 9:14:13 AM8/18/21
to Jenkins Users
I have the same issue here.
I have a .bat file named bat RunUSBRedirector.bat that only has one line

call "C:\Program Files\USB Redirector Client\usbredirectorlt.exe"
this line should start the application USB Redirector Client
when I invoke this .bat file in the cmd it behaves as expected, but when I try to run it in jenkins [bat """RunUSBRedirector.bat"""]  it gets stuck.
I tried the mentioned points:
-Run another exe (calc.exe for example) it worked, but when I tried another exe that I installed a few months ago it did not work
-using cmd /c does not change anything
-I get an error when I add a typo to the name of the exe
-I don't think the program waits for stdin, and I don't know how to close it (NOTE: cmd window does not show)
-the web interface does not get stuck

Björn Pedersen

unread,
Aug 18, 2021, 10:01:27 AM8/18/21
to Jenkins Users
mahmoud...@ejad.com.eg schrieb am Mittwoch, 18. August 2021 um 15:14:13 UTC+2:
I have the same issue here.
I have a .bat file named bat RunUSBRedirector.bat that only has one line

call "C:\Program Files\USB Redirector Client\usbredirectorlt.exe"
this line should start the application USB Redirector Client
when I invoke this .bat file in the cmd it behaves as expected, but when I try to run it in jenkins [bat """RunUSBRedirector.bat"""]  it gets stuck.
I tried the mentioned points:
-Run another exe (calc.exe for example) it worked, but when I tried another exe that I installed a few months ago it did not work
-using cmd /c does not change anything
-I get an error when I add a typo to the name of the exe
-I don't think the program waits for stdin, and I don't know how to close it (NOTE: cmd window does not show)

Yes,  that is expected. You can only usefully commands that finish at some point in time and only then the next command will be executed. 
If the program runs forever then it looks like it is stuck (but it is just  waiting for the program to finish).  
See https://superuser.com/a/341603 for how send a program into background on windows.  
You should also have some way to stop the program again before your  jenkins job exits....

Mahmoud Beltagy

unread,
Aug 19, 2021, 11:20:47 AM8/19/21
to Jenkins Users
It is important for my build to open this exe, without it the build process will fail, so the issue is not continuing the process.
I want jenkins to be able to open an external exe to use it in the build process

Slide

unread,
Aug 19, 2021, 11:28:44 AM8/19/21
to Jenkins User Mailing List
Does the application try and interact with the desktop? If you are running the agent/jenkins as a Windows service, it will not be able to interact with the desktop by default. You need to search for "services interact desktop windows" to find information on how to enable it.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/9962af5c-e61e-455a-bb9b-96f7cfb2ab21n%40googlegroups.com.


--

christop...@googlemail.com

unread,
Aug 31, 2021, 4:42:03 AM8/31/21
to Jenkins Users
In my opinion "call" is not the right statement to call an exe. Can you try it with a start with the proper arguments?
Regards,
Christoph

Björn Pedersen

unread,
Aug 31, 2021, 5:18:13 AM8/31/21
to Jenkins Users
 I would consider using powershell instead of bat for such jenkins tasks, then Start-Job should do the trick ( you will need to also call Stop-Job once you are done of course).
Reply all
Reply to author
Forward
0 new messages