55

When running Hyper-V and a virtual machine (also with a modern Windows OS), is it really not possible to copy/paste files across between host and VMs? Not even text it seems, although there is a weird "type clipboard text" option, that seems to only work sporadically.

I must be missing something.

I run Windows 8.1 as host and Windows 7 in the VM if that matters.

migrated from serverfault.com Jan 10 '15 at 15:55

This question came from our site for system and network administrators.

  • 4
    I'd just use RDP and copy files that way. – Optichip Jan 10 '15 at 15:51
  • I've been told by a Microsoft trainer that Server 2012 R2 supports copy-paste, so I would expect Windows 8.1 to also do so. Do you have Update 1 installed on the host (not sure if it's required, just asking)? More importantly, have you installed the latest integration components in the VM? – Celery Man Jan 10 '15 at 22:56
  • I simply use standard Windows shares. I do not use AD, but all my accounts have passwords thus I don't need to do any group policy hacks. It just works. – David Betz Feb 10 '16 at 16:25
  • Yes you can copy/paste - Use network sharing – ToolmakerSteve Apr 30 '17 at 9:36
  • When you connect to VM, there is popup with Display configuration. If you click Show Options > Local Resources > More.. , then you can select drive on host machine, which will be visible on the VM. – Roman O Sep 21 '17 at 7:12
16

Your best options are a plain old network copy and Remote Desktop, which instead allows full clipboard transfers.

RDP can get quite flaky if you try to copy big files over it, thus if big file transfers are required I'd recommend the network; if you just need to copy/paste some text, RDP works great.

Of course, for both options to work, you need the guest system to be connected to your network and have proper TCP/IP settings.

  • Comments are not for extended discussion; this conversation has been moved to chat. – DavidPostill May 2 '17 at 12:11
  • 1
    @ToolmakerSteve The correct place for those links in in your own answer, not as a comment on another answer. And please respect the "Comments are not for extended discussion; this conversation has been moved to chat." – DavidPostill May 2 '17 at 12:51
42

Here is a quick and easy way to get this work efficiently:

  • If you're running the VM, turn it off first.
  • find your virtual hard disk image file .vhd of your VM
  • Right click on this file and select mount
  • This will give "System Reserved" and "Local Disk" drives.
  • Open the "Local Disk" drive (this is the OS drive on VM)
  • Go there and paste you files.
  • Finally unmount or eject one of the drivers
  • Run the VM and go the c:\ drive there and you will find your files.

Hope this helps someone :)

  • This is an answer to a different question. – MariusMatutiae Jun 29 '15 at 14:03
  • 2
    To be fair, this does give you a method for copying files to the VM from the host. It might not be via the clipboard, but sometimes with older guest OSes then difficult routes like this might be required. – AdamH Nov 24 '15 at 3:37
  • 2
    That is ridiculous. I can't be shutting down the guest VM every now and then. – Blessed Geek Apr 1 '16 at 3:50
  • 2
    @BlessedGeek You can do it without shutting down the VM if instead you use a separate VHD from the VM's system drive, and attach it to the guest SCSI controller, which allows it to be mounted while the guest is running. You still can't have it mounted in both host and guest simultaneously, though. – shambulator May 26 '16 at 15:34
  • 2
    I could also move my car down the street by completely disassembling it, moving it piece by piece, and reassembling it elsewhere. But oh the efficiency... – Brain2000 May 19 '18 at 18:25
9

According to this StackOverflow answer it does matter what the guest OS is:

ESM only works with Windows 8.1 and Windows Server 2012 R2 VMs. Since you're using a Win7 VM, ESM isn't going to be available.

Although the accepted answer here says there is no way to copy and paste things, I can do it between my Windows 8.1 host and Windows 10 Tech preview running in Hyper-V with ESM. I have yet to find the Windows 8.1 documentation that explains it, but for Server 2012R2 see this TechNet article.

Edit: I found this very practical guide on ESM, which clarified that you also need the Pro or Enterprise versions.

  • Confirmed, this was (finally) introduced in Windows 8.1. It wasn't available when I posted my answer and it was accepted. – Massimo Sep 15 '15 at 7:15
  • 1
    Confirmed. Make sure you are using 'Enhanced Session' and not the 'Basic Session'. – Jimson Kannanthara James Jul 13 '16 at 3:33
4

It can be done via Powershell.

First, create a session with New-PSSession from the HOST:

$s = New-PSSession -VMName <VMName> -Credential (Get-Credential)

Then, from the HOST, copy the file via Copy-Item using the session:

Copy-Item -ToSession $s -Path C:\host_path\data.txt -Destination C:\guest_path\

See Copy files with New-PSSession and Copy-Item for details.

3

You can "burn" your files to an ISO file on the host and mount the ISO on the guest.

Windows is not able to create ISOs natively, but you can use something like *InfraRecorder (GNU GPL licensed) to create the ISO.

If you end up using InfraRecorder the create ISO action is buried in the top menu under:

Actions > Burn Compilation > to a Disc Image...


* I have no affiliation to InfraRecorder, I just needed to copy some files to a guest.

1

I have a weird problem with Copy Paste in Hyper-V, where I can copy paste after starting the VM, but if I log out of the VM OS and log back into the VM as another user, copy paste doesn't work. I found out that the Enhanced session tick in the Virtual Machine Connection window was getting removed, either shortly after I logged in or during the switch between users in the VM. I re-enabled the Enhanced Session tickmark and after that the Copy Paste function in Hyper-V works again.

  • Yep just close and re-open the VM worked for me. Don't know why all these posts about mounting drives/RDP... it should just work with normal/out of the box settings on the VM. Double-check settings when you start the connection to the VM. – Don Cheadle Jul 2 at 21:04
-2

NOTE: The question has two parts to it. The FIRST part asks "How to COPY-PASTE FILES". THIS is an answer to that part of the question. (The SECOND part asks how to copy/paste TEXT; e.g. a clipboard operation. This answer is NOT about that.)

Also see these other answers relevant to copy/paste files, in specific situations:
For ESM-compatible VMs
For initial setup before starting your VM


Files can be copy/pasted between a MAC and a PC, or a LINUX box and a PC, and the same technique can be used between a virtual machine (even using "Version 1", to run older Windows, in my case Windows 7) and its host PC.
How? Network sharing aka "Share a folder over a network".

KEY POINT: Once you have set up a shared folder, you can then do regular file-copying in a Windows Explorer view on the host PC, even if the source is on host and the destination is on VM, or vice-versa. That is, Network sharing is not just about making a set of network files visible on the VM, it also makes it easy for you to later move individual files, or complete folders, between two different computers (here, the VM is one of the computers), as if they were on a single computer.


  • Hyper-V Manager - Virtual Switch Manager.
    • Create Virtual Switch / External
  • Hyper-V / Your VM / Settings
    • Network Adapter / Virtual Switch = the External Virtual Switch from above
  • Boot your VM, login with an Administrator account.
  • Do what you normally do to "Share a folder over the network". (See documentation for the OS you are running on the VM.) In my case, I shared my username/Documents folder. specify read/write privilege, if you want to copy files both to and from that folder
  • Host machine / Windows Explorer / Network / your VM should appear with that shared folder.
    • Select your VM (its "Network" representation), and LOGIN with your VM's administrator account.
    • Copy / Paste files in this Explorer window on your host.

NOTE: I only tested with my user account / Documents folder, so I do not know whether there are limitations on what can be shared. I assume it works exactly the same as any other network sharing from the virtual OS, so it shouldn't matter that it is virtual. It is just another machine on your network, running that OS.

I also did not test with a Linux VM, however I did test with Windows 7, running "Version 1" VM - that works, so any OS that can be run under Hyper-V, and that supports network sharing with Windows, should work.

Not the answer you're looking for? Browse other questions tagged or ask your own question.