Skip to content

Instantly share code, notes, and snippets.

@MichalBrylka
Created January 15, 2025 13:28
Show Gist options
  • Save MichalBrylka/dce96cb11564b44145825fc80b774592 to your computer and use it in GitHub Desktop.
Save MichalBrylka/dce96cb11564b44145825fc80b774592 to your computer and use it in GitHub Desktop.
Process.ps1
$process = Get-Process | Where-Object { $_.MainWindowTitle -like "*xxx*" }
if ($process) {
# Get the executable file path
$exePath = Get-CimInstance -ClassName Win32_Process -Filter "ProcessId = $($process.Id)" | Select-Object -ExpandProperty ExecutablePath
Write-Output "Executable Path: $exePath"
} else {
Write-Output "No process found with the specified window title."
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment