mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-10 11:29:55 +00:00
f42544cb6b
... depending on detected shell program. For instance, if the nearest ancestor process is PowerShell, run uninstalled environment via PowerShell. Otherwise, $COMSPEC (most likely cmd.exe) will be used.
19 lines
467 B
PowerShell
19 lines
467 B
PowerShell
$i=1
|
|
$ppid=(gwmi win32_process -Filter "processid='$pid'").parentprocessid
|
|
$pname=(Get-Process -id $ppid).Name
|
|
While($true) {
|
|
if($pname -eq "cmd" -Or $pname -eq "powershell") {
|
|
Write-Host ("{0}.exe" -f $pname)
|
|
Break
|
|
}
|
|
|
|
# 10 times iteration seems to be sufficient
|
|
if($i -gt 10) {
|
|
Break
|
|
}
|
|
|
|
# not found yet, find grand parant
|
|
$ppid=(gwmi win32_process -Filter "processid='$ppid'").parentprocessid
|
|
$pname=(Get-Process -id $ppid).Name
|
|
$i++
|
|
}
|