您将如何从Windows服务中运行外部.EXE? [英] How would you run an external .EXE from within a windows service?

查看:234
本文介绍了您将如何从Windows服务中运行外部.EXE?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从Windows服务执行我的外部.exe,意味着可以从Windows服务调用并执行.exe.如果是,那么如何使用您所使用的方法,请帮助我使用您的代码.我想要一个在服务启动时成功执行.exe的示例.

i want to execute my external .exe from a windows service means is it possible to call & execute .exe from windows service. if yes, then how it possible which method u use please help me with u r code.i want one example that successfully execute .exe when service is start.

推荐答案

尝试 Process.Start [
Try Process.Start[^] - it allows you to execute any executable from within your program.


来自JSOP和Sandeep的答案是正确的,但是如果您的应用程序具有与其相关联的UI,则需要确保Windows Service具有与桌面交互"功能.
The answers from JSOP and Sandeep are correct, but if your application has a UI associated with it, you will need to ensure that your Windows Service has the "Interact with Desktop" feature enabled or it won''t work.


使用Process对象.请记住,它必须是控制台应用程序(而不是具有UI的应用程序).
With the Process object. Keep in mind that it must be a console application (as opposed to an app with a UI).


这篇关于您将如何从Windows服务中运行外部.EXE?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆