开发者

Create Task Scheduler (for running in machine restart) using MsBuild

I use VS 2008, .NEt 3.5, and MsBuild, and I need custom task MsBuild that create a "task scheduler" that it will run when the machine开发者_JS百科 restarted.

Anyone know any custom tasks in MsBuild Extensions or has any sample code about it?


I don't know of any task, but you can just use the Exec task for this. For example here is a simple usage of it for your case.

<PropertyGroup>
  <Time>23:27</Time>
  <CommandToExecute>SCHTASKS /Create /SC ONCE /TN tempTaskName /ST $(Time) /F /TR notepad</CommandToExecute>
</PropertyGroup>

<Target Name="Demo">
  <Message Text="Scheduling task" />
  <Exec Command="$(CommandToExecute)"/>
</Target>

This will create a new scheduled task named 'tempTaskName' for 11:27 PM.

The result in my case is:

Create Task Scheduler (for running in machine restart) using MsBuild

http://msdn.microsoft.com/en-us/library/x8zx72cd.aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜