Hi,
I encountered a problem, described as follows:
1. A.exe is a resident process, It is displayed continuously in the Task Manager without a GUI interface
2. B.exe relays the command line to A.exe and exits immediately! Then a new A.exe process will be generated, and the process will exit after execution is completed
3. But B.exe There is no provided parameter for waiting for New A.exe exit
With the following PowerShell code, I can achieve waiting for the new A.exe to exit. How achieve the same effect in QM?
Thank you in advance for any suggestions and help.
David
Powershell Code:
I encountered a problem, described as follows:
1. A.exe is a resident process, It is displayed continuously in the Task Manager without a GUI interface
2. B.exe relays the command line to A.exe and exits immediately! Then a new A.exe process will be generated, and the process will exit after execution is completed
3. But B.exe There is no provided parameter for waiting for New A.exe exit
With the following PowerShell code, I can achieve waiting for the new A.exe to exit. How achieve the same effect in QM?
Thank you in advance for any suggestions and help.
David
Powershell Code:
$relaysProgramPath = "C:\B.exe"
$arguments = '/start "My arg"'
Start-process -FilePath $relaysProgramPath -ArgumentList $arguments
# Set the upper limit of loop attempts and the interval time (second)
$maxAttempts = 30
$interval = 1
#Loop to check the number of processes, maximum 30 attempts
for ($i = 1; $i -le $maxAttempts; $i++)
{
# Get the number of "A.exe" processes
$processCount = (Get-process -Name "A").Count
# Check the number of processes
if ($processCount -le 1)
{
# If the number of processes is less than or equal to 1, break the loop
break
}
# Wait for the specified interval time
Start-Sleep -Seconds $interval
}
"New A.exe has exited"