简体   繁体   English

在计算机启动时启动WPF应用程序

[英]Start WPF application on computer startup

I have a WPF application that I would like to be launched anytime the computer starts NOT when a user logs in. I know I can place the .exe in the startup folder, but I don't want that since a user has to login for that to be launched. 我有一个WPF应用程序,我希望在计算机每次启动时都不会在用户登录时启动。我知道我可以将.exe放在启动文件夹中,但是我不希望这样做,因为用户必须登录即将推出。 I cannot use a Windows service, it's not an option for me. 我无法使用Windows服务,这对我来说不是一种选择。

Is there a way to start up an application once the PC starts up(or reboots), even before a user logs in? 一旦PC启动(或重新启动),甚至在用户登录之前,是否有办法启动应用程序? Any help is much appreciated. 任何帮助深表感谢。

You can't run an application without a user login. 没有用户登录,您将无法运行应用程序。 The only thing you can run is a Service , which I'm guessing from your question being about WPF that this is not what you want. 您唯一可以运行的是Service ,我从关于WPF的问题中猜测这不是您想要的。

How about using the Task Scheduler? 如何使用任务计划程序? In Windows 7, there's a "Security options" section where you can set an option for a task to run whether a user is logged on or not. 在Windows 7中,有一个“安全性选项”部分,您可以在其中设置任务的运行选项,无论用户是否登录。 You can specify an executable file, and it'll start when Windows starts up. 您可以指定一个可执行文件,该文件将在Windows启动时启动。

(This won't scale though, if you're looking for an option when a user installs your software. For that, a service is the correct way to go... you may need to elaborate in your question why exactly you can't use a service.) (不过,如果用户在安装软件时正在寻找一个选择,这将无法扩展。为此,服务是正确的选择……您可能需要详细说明为什么可以做到这一点?”不要使用服务。)

在此处输入图片说明

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM