Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
需要编写脚本以结束windows 7中的进程_Windows_Process - Fatal编程技术网

需要编写脚本以结束windows 7中的进程

需要编写脚本以结束windows 7中的进程,windows,process,Windows,Process,我需要制作一个脚本或程序来检测某个程序何时打开和关闭。当程序关闭时,脚本/程序应结束另一个正在运行的进程。我应该如何着手做这件事,如何编写代码?提前谢谢 此snip验证calc.exe是否正在运行,如果未运行,则会杀死所有notepad.exe实例。从Powershell中运行 $path = "C:\Windows\system32\calc.exe" get-process | where-object {$_.Path -eq $path } | measure-objec

我需要制作一个脚本或程序来检测某个程序何时打开和关闭。当程序关闭时,脚本/程序应结束另一个正在运行的进程。我应该如何着手做这件事,如何编写代码?提前谢谢

此snip验证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}
#

到目前为止你试过什么吗?怎么样?我都不知道怎么开始。我不知道我应该使用windows脚本还是其他什么?在谷歌搜索之后,他没有看到太多,