PowerShell - get process ID of called application
Use Start-Process
with the -PassThru
argument like this:
$app = Start-Process notepad -passthruWait-Process $app.Id
More succinct:
# Starts Notepad and returns the ID(Start-Process Notepad -passthru).ID