使Windows服务启动Windows程序。 [英] Make a Windows Service start a windows program.

查看:83
本文介绍了使Windows服务启动Windows程序。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Windows服务有没有办法启动Windows程序?我有一个

服务,如果需要,需要重新启动Windows应用程序。


TIA - 杰夫。

解决方案

问题是服务不是交互式程序,因此在用户登录之前它已经加载了



您需要检查用户是否已登录并且仅在该启动应用程序之后。


UJ写道:

有没有办法让Windows服务启动Windows程序?如果需要,我有一个需要重新启动Windows应用程序的服务。

TIA - Jeff。




- -

WBR,

Michael Nemtsev ::博客: http://spaces.msn.com/laflour


有时一个人仍忠于某一事业只是因为它的对手没有

不再是平淡的。 (c)Friedrich Nietzsche


只是为了添加到我的帖子中,你可以使用WMI(System.Management)和

查询Win32_LogonSession以检查登录用户的可用性

" Michael Nemtsev"写道:

问题是服务不是交互式程序,因此在用户登录之前它已经加载了。
您需要检查是否用户登录并且仅在启动应用程序之后。

UJ写道:

有没有办法让Windows服务启动Windows程序?如果需要,我有一个需要重新启动Windows应用程序的服务。

TIA - Jeff。



-
WBR,
Michael Nemtsev ::博客: http://spaces.msn.com / laflour

有时一个人仍然忠于一个事业,只因为它的对手不会停止平淡。 (c)Friedrich Nietzsche




-

WBR,

Michael Nemtsev ::博客: http://spaces.msn.com/laflour


有时一个人仍然忠于一个事业,只因为它的对手没有,b $ b不再是平淡无奇的。 (c)Friedrich Nietzsche




" UJ" < FR ** @ nowhere.com>在消息中写道

新闻:eA ************** @ TK2MSFTNGP15.phx.gbl ...

|有没有办法让Windows服务启动Windows程序?我有

a

|需要重新启动Windows应用程序的服务。

|

| TIA - Jeff。

|

|


没有(简单,安全和便携)的方法。一个Windows服务

在沙盒非可见桌面上运行,一个从服务启动的进程

继承相同的UI上下文,因此它将在同一个桌面上运行,其次是

服务不在登录用户的安全上下文中运行(如果有的话),

表示已启动的应用程序无法访问交互式用户

个人资料,因此很可能无法在environmant初始化

变量或个人资料设置。


Willy。

Is there any way for a windows service to start a windows program ? I have a
service that will need to restart a windows app if it needs to.

TIA - Jeff.

解决方案

The problem is that service isn''t interactive program, thus it''s loaded
before user logged on.
You need to check whether the user logged on and only after that start app.

"UJ" wrote:

Is there any way for a windows service to start a windows program ? I have a
service that will need to restart a windows app if it needs to.

TIA - Jeff.



--
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche


Just to add to my previos post than u can use WMI(System.Management) and
query to the Win32_LogonSession to check for availability of logged user
"Michael Nemtsev" wrote:

The problem is that service isn''t interactive program, thus it''s loaded
before user logged on.
You need to check whether the user logged on and only after that start app.

"UJ" wrote:

Is there any way for a windows service to start a windows program ? I have a
service that will need to restart a windows app if it needs to.

TIA - Jeff.



--
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche



--
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche



"UJ" <fr**@nowhere.com> wrote in message
news:eA**************@TK2MSFTNGP15.phx.gbl...
| Is there any way for a windows service to start a windows program ? I have
a
| service that will need to restart a windows app if it needs to.
|
| TIA - Jeff.
|
|

No there is no (easy, secure and portable) way to do this. A windows service
runs in a sandboxed non visible desktop, a process started from a service
inherits the same UI context so it will run in the same desktop, second the
service does not run in the security context of a logon user (if any), that
means that the lauched application won''t have access to an interactive user
profile, so chances are that it fails to initialize when environmant
variables or profile setting are needed.

Willy.


这篇关于使Windows服务启动Windows程序。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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