title: Powershell call batch within scriptblock
body: <p>I have the script below which is not working the way I want. Initially, I would like to pass install.cmd to function which will use the "Start-Job" in the background so that it doesn't freeze up the main Powershell window. But I can't get it to call the install.cmd. </p>
  
  <pre><code>$Appname = @("Adobe_FlashPlayer", "Acrobat_Reader", "Microsoft_RDP")
  
  function BatchJob{
  
      Param (
          [ScriptBlock]$batchScript,
          $ArgumentList = $null)
      #Start the batch
      $batch = Start-Job -ScriptBlock $batchScript -ArgumentList $ArgumentList
  
  }
  
  Foreach($App in $Appname){
      $Install = "C:\test\$App\Install.cmd"
      Batchjob -batchscript {Invoke-Command (cmd / c)} -ArgumentList $install     
      Wait-Job $job
      Receive-Job $job
  }
  </code></pre>