I am trying to execute an .exe file with PowerShell by doing:
$myExe = Join-Path $scriptDir "\bin\my\myProgram.exe"
$job = Start-Job -ScriptBlock{
& $myExe }
But it doesn't execute. When in type in the file path in $myExe, the program works as expected, but when I use the above code, nothing happens. Can someone explain what I'm doing wrong; or, why I'm not getting the expected results?
To be clear, the expected result (at this point) is to get a firewall warning. Again, when I type in the path directly to the PS console, the firewall warning comes up, but using the above code, nothing seems to happen. I've also tried to check the status using Get-Process but the result is the $job variable, saying it's running.
UPDATE:
Running:
$myExe = Join-Path $scriptDir "\bin\my\myProgram.exe"
& $prndExe
Causes PowerShell to hang
UPDATE 2:
When I do the following, the program works and the process starts:
Start-Job -ScriptBlock{ & "C:\path\Music\source\p\android\test\Automation\bin\mym\myProgram.exe"}
But using the above code doesn't. This leads me to believe I'm doing something wrong with the Start-Job cmdlet?
$myExeto the console, and then taking that output and putting it into the console to get it to 'work'. When I use& $myExeoutside of thescriptBlockthe program just hangs.C:\my\Music\source\lk\android\test\Automation\bin\myfolder\myProgram.exe. I have taken that output and put it into the console, and had the expected result. Would running this as a background process make it run differently?