title: How to confirm completion of previous command in powershell
body: <p>I have a simple powershell script that gets ran daily to compress and move some log files. How can i test that the command completes successfully before deleting the original log file. </p>
  
  <pre><code>set-location $logpath1
  &amp; $arcprg $pram $dest_file $source_file
  Move-Item $dest_file $arcdir
  </code></pre>
  
  <p>If the Move-Item completes ok i want to remove-item $source_file</p>