关闭程序后运行powershell文件

关闭程序后运行powershell文件,powershell,Powershell,我不知道这是否与此处有关,但有一种方法可以在关闭特定程序后运行powershell文件。例如,如果我自动关闭microsoft word,将打开powershell文件。 谢谢。有选择吗 while (Get-Process -Name "powershell" -ErrorAction SilentlyContinue) { Write-Host -Object "Running..." Start-Sleep -Seconds 5 } Start-Process -File

我不知道这是否与此处有关,但有一种方法可以在关闭特定程序后运行powershell文件。例如,如果我自动关闭microsoft word,将打开powershell文件。 谢谢。

有选择吗

while (Get-Process -Name "powershell" -ErrorAction SilentlyContinue)  {
    Write-Host -Object "Running..."
    Start-Sleep -Seconds 5
}
Start-Process -FilePath "MSG.Exe" -ArgumentList "* Stopped..."

你能给我更多的信息吗?应用程序是用powershell启动的吗?您可以在后台运行powershell脚本,监视某个进程,并在该进程不再存在时执行某些操作,例如?