[英]How to ensure C# application starts after windows is booted compltely
I want to create a simple checker console application that should run at startup on developer's machines and check some items. 我想创建一个简单的检查器控制台应用程序,该应用程序应在启动时在开发人员的计算机上运行并检查某些项目。 This is to make sure that all developers are working according to a predefined policy that gets updated on regular basis. 这是为了确保所有开发人员都根据预先定义的策略进行工作,该策略会定期更新。
Everything works just fine, except that this console application runs before Windows is truly booted (user is not logged in yet), and our application encounters access denied exceptions in some places. 一切运行正常,除了此控制台应用程序在真正启动Windows(用户尚未登录)之前运行之前,并且我们的应用程序在某些地方遇到拒绝访问的异常。
In this answer , it's suggested that we either change the console to Windows service, or make it a Windows scheduled task, none of which is desirable in our situation. 在此答案中 ,建议我们将控制台更改为Windows服务,或者将其设置为Windows计划的任务,在我们的情况下,这些都不是理想的。
Is there any way to check that Windows is fully booted, and user is logged in (for example in a while loop) and after that continue the code in .NET? 有什么方法可以检查Windows是否已完全启动,并且用户已登录(例如,在while循环中),然后在.NET中继续执行代码?
open 打开
[HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run] [HKEY_CURRENT_USER \\ Software \\ Microsoft \\ Windows \\ CurrentVersion \\ Run]
For each program you want to start automatically create a new string value using a descriptive name, and set the value of the string to the program executable 对于要启动的每个程序,将使用描述性名称自动创建一个新的字符串值,并将该字符串的值设置为程序可执行文件
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.