启动特定文件时是否可以运行脚本? (在这种情况下访问)如果是这样,是否有可能使用Windows任务计划程序?另外,请记住我使用powershell来开发脚本。启动特定程序时运行脚本
0
A
回答
1
也许你可以使用WMI事件监视器。此片段等待calc.exe启动,然后运行脚本将优先级调低。 Afterwords循环等待calc.exe的下一个实例生成。
$prog = Get-Process -Name calc | ?{$_.PriorityClass = [System.Diagnostics.ProcessPriorityClass]::Idle}
while($true)
{
$Query = "select * from __instanceCreationEvent within 1 where targetInstance isa 'win32_Process' AND TargetInstance.Name = 'calc.exe'"
$Eventwatcher = New-Object management.managementEventWatcher $Query
$Event = $Eventwatcher.waitForNextEvent()
$prog = Get-Process -Name calc | ?{$_.PriorityClass = [System.Diagnostics.ProcessPriorityClass]::Idle}
}
附加信息。
另一个例子。
相关问题
- 1. 在脚本启动时自动运行一个程序
- 2. Ubuntu:无法在启动时从程序运行脚本
- 3. 启动终端时运行脚本
- 4. 在OpenWRT启动时运行脚本
- 5. 启动时运行Bash脚本mac
- 6. 在启动时运行Linux脚本
- 7. 在Windows RT启动时运行脚本
- 8. Linux启动时运行php脚本
- 9. 实例启动时运行shell脚本
- 10. 在Ubuntu启动时运行Perl脚本
- 11. 启动脚本运行Jar
- 12. 仅在特定时间运行脚本
- 13. 在特定时间运行perl脚本
- 14. 在启动时自动运行shell脚本(自动启动)
- 15. 启动时自动运行程序
- 16. 如何让Arduino每次启动时都运行特定的脚本?
- 17. 将Python脚本作为启动脚本运行时结束?
- 18. 运行AutoHotKey脚本启动屏幕保护程序激活
- 19. 启动后自动运行python脚本?
- 20. 在重新启动时运行.sh脚本并保持运行
- 21. 在启动时运行python脚本作为守护进程(Ubuntu)
- 22. 如何在JBOSS AS启动时运行/启动特定服务?
- 23. 在启动时运行应用程序
- 24. 在启动时运行程序Ubuntu
- 25. 启动时运行c程序
- 26. 运行程序在Windows启动时
- 27. 启动时运行的Ubuntu程序
- 28. 在启动时运行应用程序
- 29. 使用initramfs启动时运行程序
- 30. 在启动时运行程序
可能您启动您的访问文件作为脚本的一部分脚本,并肯定可以完成作为计划的作业。 – TheMadTechnician 2014-09-22 20:08:11
本地计算机上有一个文件,服务器上有一个文件。每次我打开本地机器文件,我想检查服务器的文件的更新版本,并复制它,如果它存在。 – Jerms3033 2014-09-22 20:22:42
我真的不明白你为什么希望它成为计划任务。只需编写一个执行'If((gci \\ server \ share \ file).lastwritetime -lt(gci c:\ path \ to \ file).lastwritetime){copy-item \\ server \ share \ file - 目的地c:\ path \ to \ file -force;&c:\ path \ to \ file}',并且每当你想打开数据库时调用该脚本。 – TheMadTechnician 2014-09-22 20:39:16