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
8,825 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,220 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
3,081 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
1,773 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,460 points
2,997 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, 2022 in Others by gaurav
• 23,260 points
683 views
0 votes
0 answers

Compiling New C# Versions (C# 7.0 Higher) From The Command Line

When I use Microsoft's Visual C# Compiler ...READ MORE

May 27, 2022 in Others by pranav
• 2,590 points
611 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
477 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,140 points
5,716 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
1,110 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
11,294 views
0 votes
1 answer

SQLite.Net not being able to create text file in Win IoT Library!

That exception comes when access limited to ...READ MORE

answered Aug 3, 2018 in IoT (Internet of Things) by nirvana
• 3,130 points
1,003 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP