登录时启动winform - 具有管理员权限(c#) [英] Start winform on logon - with admin rights (c#)

查看:581
本文介绍了登录时启动winform - 具有管理员权限(c#)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序需要管理员权限,因为处理过程终止 -

i需要它在用户登录时启动


$ b $我已经尝试过:

- taskschedueler - 但是我的命令行有些问题不够有效

i have an application which requires admin rights due to handling process killing -
i need it to start when the user logs-on

ive tried:
- taskschedueler - but i have a few problems with the command line not being efficient enough

schtasks /create /tn mytaskname /tr "myfilelocation" /RL Highest /sc ONLOGON

- 因为它仍会检查交流适配器选中标记(和/ RL在win-xp机器上无效)



- regedit

- since it still checks the "ac-adapter" checkmark amongst others (and /RL doesnt work on win-xp machines)

- regedit

[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run]



这不会启动winform

甚至尝试过 -


this wont start the winform
even tried -

[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\Userinit]





仍无济于事。



i正考虑创建一个Windows服务 - 这真的有点矫枉过正。

所以我的问题是 - 还有其他方式 - 除了taskchedueler,regedit和创建一个Windows服务,这将允许我在启动时使用管理员权限启动winform

(清单没有帮助实现这一点btw)



still to no avail.

i was thinking about creating a windows service - this seems a bit overkill really.
so my question is - is there any other way - besides taskschedueler, regedit and creating a windows service, that will allow me to start the winform with admin rights at startup
(manifest doesnt help accomplish this btw)

推荐答案

根据本说明 [ ^ ],Run键应自动启动应用程序。也许你可以在注册表中显示你的条目的确切内容。
According to this note[^] on MSDN, the Run key should automatically start the application. Perhaps you could show the exact content of your entry in the registry.


我认为我找到了一个合适的解决方案 http ://taskscheduler.codeplex.com [ ^ ]

这是任务schedueler的程序集包装器 - 允许完全自定义设置..



看起来很简单
i think ive found a move suitable solution http://taskscheduler.codeplex.com[^]
which is an assembly wrapper for task schedueler - which allows fully customized settings..

seems simple enough


这篇关于登录时启动winform - 具有管理员权限(c#)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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