#!/usr/bin/env python3 """check_extract.py -- 若有 extract.py 的 python 进程在跑则输出 True,否则 False。""" import subprocess out = subprocess.run( ["powershell", "-NoProfile", "-Command", "(Get-CimInstance Win32_Process -Filter \"Name='python.exe'\" | " "Where-Object { $_.CommandLine -match 'extract.py' }) -ne $null"], capture_output=True, text=True, timeout=60) print("True" if "True" in out.stdout else "False")