如何确保在Windows启动后启动C#应用程序(How to ensure C# application starts after windows is booted compltely)
我想创建一个简单的检查程序控制台应用程序,它应该在开发人员的机器上启动时运行并检查一些项目。 这是为了确保所有开发人员都按照定期更新的预定义策略工作。
一切正常,除了这个控制台应用程序在Windows真正启动之前运行(用户尚未登录),并且我们的应用程序在某些地方遇到访问被拒绝的异常。
在这个答案中 ,建议我们将控制台更改为Windows服务,或者将其设置为Windows计划任务,在我们的情况下,这些任务都不可取。
有没有办法检查Windows是否完全启动,并且用户已登录(例如在while循环中),之后继续使用.NET中的代码?
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.
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.
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?
原文:https://stackoverflow.com/questions/36718474
最满意答案
尝试使用以下内容
var fromDate = new Date($scope.date.from).toUTCString();
时区差异存在问题。
So the answer to make this work is this:
var DateFrom = new Date(Date.UTC(fromDate.getFullYear(),fromDate.getMonth(),fromDate.getDate(),0,0,0,0)); var DateTo = new Date(Date.UTC(toDate.getFullYear(),toDate.getMonth(),toDate.getDate(),23,59,59,0));
相关问答
更多-
在onLoad()函数中实例化一次beforeShowDay()并在beforeShowDay()定义beforeShowDay()方法。 每次显示beforeShowDay()都会调用beforeShowDay() ,允许您每次迭代日期。 $(function(){ $("your-selector").datepicker({ beforeShowDay: function(date) { // Either put the enable days cod ...
-
如果您的日期格式与示例中的日期格式相同,则可以使用以下函数将日期添加到日期中。 获得新日期后,您可以使用新添加的日期 function addDays(date, days) { var result = new Date(date); result.setDate(result.getDate() + days); return result; } 使用 addDays(new Date('2017-12-31'),1); OUT Put Mon Jan 01 2018 00:00:00 G ...
-
Date.getDay()返回0-6范围内的值,而不是1-7 。 beforeShowDay: function(date) { return [date.getDay() === 0,'']; } Date.getDay() returns a value in the range 0-6, not 1-7. beforeShowDay: function(date) { return [date.getDay() === 0,'']; }
-
尝试使用以下内容 var fromDate = new Date($scope.date.from).toUTCString(); 时区差异存在问题。 So the answer to make this work is this: var DateFrom = new Date(Date.UTC(fromDate.getFullYear(),fromDate.getMonth(),fromDate.getDate(),0,0,0,0)); var DateTo = new Date(Dat ...
-
我终于找到了问题。 我使用了Google Chroms Element检查器并发现,另一个div覆盖了datepicker div。 解决了这个问题之后,一切都恢复了:) I finally found the problem. I used Google Chroms Element inspector and discovered, that another div was overlaying the datepicker divs. After fixing that problem, everyt ...
-
根据文件 : var date = $(this).datepicker('getDate', true); jQuery('[data-toggle="datepicker"]').datepicker({ format: 'yyyy-mm-dd', pick: function(e) { var date = $(this).datepicker('getDate', true); jQuery(this).attr('value', date) ...
-
JQuery DatePicker将月份添加到月末的最后一天(JQuery DatePicker to add month to last day of the end month)[2022-06-01]
添加6个月后,您可以排除一天 date.setDate(date.getDate() - 1); 这是一个工作示例: http : //jsfiddle.net/ddan/nmtyvyc0/ After adding the 6 months you can exclude one day with date.setDate(date.getDate() - 1); Here is a working example: http://jsfiddle.net/ddan/nmtyvyc0/ -
如何使用jQuery Datepicker在选定日期显示其他信息?(How to show additional info on selected day using jQuery Datepicker?)[2022-10-31]
添加此数组: var weekday=new Array(7); weekday[0]="Sunny Sunday"; weekday[1]="Manic Monday"; weekday[2]="Terrible Tuesday"; weekday[3]="Wild Wednesday"; weekday[4]="Thorny Thursday"; weekday[5]="Freaky Friday"; weekday[6]="Sadistic Saturday"; 然后添加此方法: onSel ... -
以下代码应该适合您: $('#toDate').datepicker({ inline: true, altField: '#x', dateFormat: "dd-mm-yy", //day altFormat: "yy-mm-dd", //year monthNames: ["Ocak", "Şubat", "Mart", "Nisan", "Mayıs", "Haziran", "Temmuz", "Ağustos", "Eylül", "Ekim", "Kas ...
-
这应该可以做到这一点: $(function(){ $("input").datepicker( { beforeShowDay: function (date) { if (date.getDate() == 15 || date.getDate() == 1) { return [true, '']; } return [false, '']; } }); }); 查 ...