title: Powershell script to copy a file into all given subfolders?
body: <p>A little heads up that this is my first powershell scripting project. I'm trying to write a script that prompts the user for a source file and a directory to copy it into. The script runs with no errors but doesn't actually copy the file. Any help would be greatly appreciated. A usage example would be: copy C:\Users\User\Desktop\info.txt to C:\Users\User\Documents\*</p>
  
  <pre><code>$source = Get-ChildItem -Path (Read-Host -Prompt 'Enter the full name of the file you want to copy')
  $dirs = Get-ChildItem -Path (Read-Host -Prompt 'Enter the full name of the directory you want to copy to')  
  
  foreach ($dir in $dirs){
     copy $source $dir
  }
  </code></pre>