I made a few changes to your script that make it work, you may need to tweak it a little bit to accomplish your goals:
$source = Get-Item -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-Item $source $dir.FullName
}
First, I changed $source from Get-ChildItem to Get-Item because you specified that it should find a single file.
From there, when I ran the script, I noticed that instead of files being made in the directories, it just made a bunch of files that were named identically to the directories.
To investigate this behavior, I added -whatif to the end of the Copy-Item commandlet.
Copy-Item $source $dir -whatif
This gave me the following output:
What if: Performing operation "Copy File" on Target "Item: H:\test\source\test.txt Destination: H:\test\Folder1".
What if: Performing operation "Copy File" on Target "Item: H:\test\source\test.txt Destination: H:\test\Folder2".
What if: Performing operation "Copy File" on Target "Item: H:\test\source\test.txt Destination: H:\test\Folder3".
What if: Performing operation "Copy File" on Target "Item: H:\test\source\test.txt Destination: H:\test\Folder4".
This explained the weird output of the script, it was misunderstanding the destination. Sometimes Powershell doesn't understand what you're trying to do so you have to be more explicit.
I then ran the following command:
$dir | select *
This gives a lot of properties, but the important one is this:
FullName : H:\test\Destination\Folder4
So I changed up the script to this:
Copy-Item $source $dir.FullName
After making these changes, running the script copied the test.txt file I specified into each of the subdirectories in the destination folder.