title: Wait for a script to finish
body: <p>I am using a script which backups the folders and than in the next block tries to delete those folder from there original location.This is the script </p>
  
  <pre><code>if ($confirmation -eq 'y') {
    # 3. BACKUP script
    ./bakup_mysite.ps1
  
    # 4. DELETE CONTENTS OF my_site
    get-childitem "C:\inetpub\wwwroot\my_site\" -recurse | % {
      remove-item $_.FullName -recurse -force
    }
  }
  </code></pre>
  
  <p>If I put a <code>Read-Host</code> after step 3 it does stop and ask the user to press any key and then it deletes the next block. But I want to put a wait so the user doesn't have to press any key and everything happens automatically.</p>
  
  <p>This is the backup code which gets called from my_site.ps1</p>
  
  <pre><code>$Service_folder_name = 'C:\Services\'
  $Pics_folder_name = 'C:\Pics\'
  
  
  $Date = Get-Date
  
  $folder_date = $Date.ToString("yyyy-MM-dd_HHmm")
  
  $backup_folder_name = 'c:\_Backups\my_site\' + $folder_date
  
  if (!(Test-Path -path $backup_folder_name)) {
  
  New-Item $backup_folder_name -type directory
  }
  
  if ((Test-Path -path $Pics_folder_name)) {
  gi $pics_folder_name | .\Library\out-zip.ps1 $backup_folder_name\pics.zip $_
  }
  
  if ((Test-Path -path $Service_folder_name)) {
  gi $Service_folder_name | .\Library\out-zip.ps1 $backup_folder_name\Services.zip $_
  }
  </code></pre>