Here is my issue. I run a command line application within a PowerShell script using the Call Operator (i.e. the & symbol), such that it is:
& $PathToExe /switch:"lots of args" /anotherswitch:"with more parms" /etc:"$WithAlsoVariables"
This works well, in fact a little too well. The process is called but the script will continue whilst the process is still running. In the most part, this is OK, as the rest of the script doesn't rely on the output of this process, but I need to clean up after the process has finished.
I was possibly looking at the Start-ProcessCmdLet with the -wait parameter, which I'm sure would do what I need, but also slow down things a little. The EXE could be run in parallel, although I would need to know when the process was finished. I could run a simple Do-While loop at the end, checking to see if the process had finished before clean up, but I don't know how to get the specific Process ID for the invoked EXE. I can't check simply for the process name as there could be other manually started processes of the same name running.
I have spent a time trawling some site (such has here) but nothing has popped up yet. Help would be welcome.
I have tried:
$proc = & $PathToExe /switch:"lots of args" /anotherswitch:"with more parms" /etc:"$WithAlsoVariables"
And although the process starts, the arguments are now incorrect as it stops immediately
Recent Questions...
ما را در سایت Recent Questions دنبال میکنید
برچسب:
نویسنده: استخدام کار
بازدید: 183
تاريخ: شنبه
18 ارديبهشت
1395 ساعت: 9:45