如何使用 Windows Server 任务计划程序在文件夹发生任何更改时触发任务?

Jul*_*rra 10 windows windows-server-2008 scheduled-task task-manager task-scheduler

每次修改文件夹树时是否可以启动脚本。

例如:

root
  dir1
    file1
  dir2
    file1
    file2
Run Code Online (Sandbox Code Playgroud)

root将被监听,例如,如果 file2 被修改或在目录树中的任何地方添加了一个新文件,脚本就会启动。

一个子问题是:是否由排队的事件触发的计划任务?

谢谢你的帮助!

小智 7

您当然可以使用 Powershell 和 WMI 事件来做到这一点。

这是一个描述设置 PowerShell 以监视事件的链接。

http://www.pavleck.net/powershell-cookbook/ch31.html韦巴克链接,因为它出现了2013年11月5日)

这是一个链接,描述了您要查找的事件类型:

http://blogs.technet.com/b/heyscriptingguy/archive/2005/04/04/how-can-i-monitor-for-different-types-of-events-with-just-one-script.aspx