title: Wait for batch file to finish process in Powershell before executing other commands?
body: <p>I'm trying to execute a Powershell file which needs to execute batch file and once batch file processing completes then only proceed to next command And, batch process shouldn't open a new window.</p>
  
  <pre><code>$p = Start-Process $dir\bin\stop.bat -Wait -Passthru
  $p.WaitForExit()
  if ($p.ExitCode -eq 0) {
        java "-Dtar.memoryMapped=true" -Xms8g -Xmx8g -jar oak-run-1.4.6.jar checkpoints $dir\repository\segmentstore | Out-File $log_path\log_checkpoints.txt }
  </code></pre>
  
  <p>I tried above code but it's not working.</p>