Copy and paste files through clipboard in Powershell


In the folder E:\Files there are 2 files, which I want to copy and paste into D:\Dest:


  • File1.txt
  • File2.txt

Using the keyboard I would simply select the 2 files, push ctrl+c, and in the destination folder D:\Dest\ I then push ctrl+v.

Now I want to achieve this using Powershell. So I copy the files into the clipboard:

But how to paste those files now into the destination folder? Obviously, I will need Get-Clipboard. But it’s not quite clear to me, how to use it, in order to paste the files.

I know I could copy the contents of these 2 files and then by using Set-Content create those files in D:\Dest\ on my own and copy the content into them. But is there any direct way? Because with Set-Clipboard those files already are in the clipboard. They just need to be pasted. I can use ctrl+v and it works. But I want to paste them through Powershell. Any ideas?


Here’s the script I use to paste files/directories:


Copy and paste files through clipboard in Powershell by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply