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
6,092 views

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,190 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
1,720 views
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
568 views
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 18, 2020 in Others by MD
• 95,340 points
1,348 views
0 votes
1 answer

AWS EC2: Instance from my own Windows AMI is not reachable

The existing administrator password (and other user ...READ MORE

answered Mar 9 in Others by Edureka
• 8,820 points
37 views
0 votes
0 answers

why linux is more secure than windows?

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

Jul 12, 2018 in Others by kristena1234
• 160 points
196 views
0 votes
1 answer

Events & Threading in Windows Forms

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

answered Nov 10, 2018 in Others by nirvana
• 3,130 points
285 views
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,100 points
4,435 views
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,130 points
486 views
+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,350 points
7,145 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP