Safest way to run BAT file from Powershell script
To run the .bat, and have access to the last exit code, run it as:
& .\my-app\my-fle.bat
Try this, your dot source was a little off. Edit, adding lastexitcode bits for OP.
$A = Start-Process -FilePath .\my-app\my-fle.bat -Wait -passthru;$a.ExitCode
add -WindowStyle Hidden
for invisible batch.