Hello everyone. Is there way to start external command from Powershell and exit PSH before the external command finishes?
I have a php script, which is executed via php.exe, say something like “C:\PHP\php.exe script.php”.
I need to run this command, but not wait until it completes. I’ve tried using jobs, but the job only executes in the current PSH session, so if I do something like:
powershell.exe -Command {$exe = ‘C:\php\php.exe’; $arg1 = ‘C:\scripts\script.php’; Start-Job {&$args[0] $args[1]} -ArgumentList @($exe, $arg1)}
it will fail, since PSH exits and the job won’t run.
That PHP script can run for couple of minutes, but I need to just start the process and exit Powershell and don’t wait for completion. Can that be done?
Thanks in advance