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 in Others by Priyanka
• 120 points
410 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 by Omkar
• 67,120 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

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
27 views
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,060 points
50 views
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 in Others by Mythlli
14 views
0 votes
1 answer

How is functional testing different from non functional testing?

Hey @Sinha, functional testing is performed using the ...READ MORE

answered Feb 18 in Others by Anusha
23 views
0 votes
2 answers

What is white box testing and how is it different from black box testing?

Black Box Testing is a software testing method in ...READ MORE

answered Feb 20 in Others by preetiagarwal
• 170 points
39 views
0 votes
1 answer

How to install C#

Hi @Akanksha, C# is a programming language ...READ MORE

answered Feb 28 in Others by Pratibha
• 2,740 points
28 views
0 votes
2 answers

Trying to upload files using Selenium(C#)

For uploading file using C# we use ...READ MORE

answered Feb 1 in Selenium by anonymous
757 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,060 points
137 views
+6 votes
15 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
• 37,320 points
230 views
0 votes
1 answer