Call third party exe from windows service c

0 votes
I want to call third party .exe from my windows service.How can i do that with c#?

When i run service in debug mode i can call .exe. It is working with "Process.start("path of .exe")" on service start.

But when i create setup project for installing service , .exe is not called on service start.
Feb 28, 2019 in Others by Priyanka
• 120 points

1 answer to this question.

0 votes

Hi @Priyanka!

The reason this is not working is probably that you are using Windows Vista or later. This is not working because you are trying to execute this from a Windows Service and not from a Windows Application. Creating a standard windows application instead of a service should solve this problem. I have mentioned a code for your reference: 

ProcessStartInfo info = new ProcessStartInfo(@"c:\myprogram.exe");
info.UseShellExecute = false;
info.RedirectStandardError = true;
info.RedirectStandardInput = true;
info.RedirectStandardOutput = true;
info.CreateNoWindow = true;
info.ErrorDialog = false;
info.WindowStyle = ProcessWindowStyle.Hidden;

Process process = Process.Start(info);
answered Feb 28, 2019 by Omkar
• 69,170 points
But If i want to call it from windows service only then what should i do?
When you ran your command, did you check the "Allow to interact with the Desktop" option in Windows Service property?

Related Questions In Others

+1 vote
0 answers

run ansible-playbook from jenkins on windows

I installed jenkins on windows machine.  Ansible ...READ MORE

Nov 4, 2019 in Others by Sivakumar
• 130 points
0 votes
1 answer

Is it possible to vibrate from broadcast receiver during incoming call?

Hello Android Native Development I have found some ...READ MORE

answered May 9, 2020 in Others by Anadya
0 votes
1 answer

I would like to know the Steps involved to remove an Apache Solr from Windows 10 Computer

Hi@Ganapathy, There are several different possibilities for why ...READ MORE

answered Aug 17, 2020 in Others by MD
• 95,300 points
0 votes
0 answers

why linux is more secure than windows?

which features make linux more secure than ...READ MORE

Jul 11, 2018 in Others by kristena1234
• 160 points
0 votes
1 answer

Events & Threading in Windows Forms

I don't think you should be updating ...READ MORE

answered Nov 9, 2018 in Others by nirvana
• 3,150 points
0 votes
1 answer

How is regression testing different from functional testing?

Functional testing is testing a section of code ...READ MORE

answered Feb 18, 2019 in Others by Mythlli
0 votes
3 answers

Trying to upload files using Selenium(C#)

You can try using Javascript Executor to ...READ MORE

answered Aug 23, 2019 in Selenium by Abha
• 28,040 points
0 votes
1 answer

Deploy my Windows 10 IOT core application locally!

Of course, you, can! That is, in ...READ MORE

answered Jul 17, 2018 in IoT (Internet of Things) by nirvana
• 3,150 points
+6 votes
16 answers

How do backend of these really cool games work?

Most of the games these days don't ...READ MORE

answered Jul 19, 2018 in Career Counselling by Kalgi
• 52,370 points
0 votes
1 answer