我需要创建一个脚本或程序来检测某个程序何时打开和关闭。程序关闭时,脚本/程序应该结束另一个正在运行的进程。我该怎么做呢?我该怎么编码呢?提前谢谢!
答案 0 :(得分:0)
此剪辑验证calc.exe是否正在运行,如果没有,则会终止所有notepad.exe实例。从Powershell运行。
$path = "C:\Windows\system32\calc.exe"
get-process | where-object {$_.Path -eq $path } | measure-object | where-object { $_.Count -eq 0} | foreach-object {taskkill /f /IM notepad.exe}
#