78

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.

7
  • 4
    I'd just use RDP and copy files that way.
    – Optichip
    Jan 10, 2015 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, 2015 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, 2016 at 16:25
  • Yes you can copy/paste - Use network sharing Apr 30, 2017 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, 2017 at 7:12

8 Answers 8

22

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.

4
  • Comments are not for extended discussion; this conversation has been moved to chat.
    – DavidPostill
    May 2, 2017 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, 2017 at 12:51
  • Is this still accurate as of 2023? Doesn't Hyper-V have some kind of guest integration features now?
    – Simon E.
    Mar 2, 2023 at 11:18
  • @SimonE. unfortunately, yes. You can use enhanced session mode when connecting to a VM and you'll have full clipboard support (including file transfer)... but it's actually built on RDP, so you still need a network connection to the VM for it to work.
    – Massimo
    Mar 2, 2023 at 11:54
54

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 :)

8
  • 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, 2015 at 3:37
  • 5
    That is ridiculous. I can't be shutting down the guest VM every now and then. Apr 1, 2016 at 3:50
  • 3
    @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. May 26, 2016 at 15:34
  • 4
    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, 2018 at 18:25
  • 5
    Caution This corrupted my disk when I tried - I think because I had snapshots. The VHD became out of sync with the differentiating drive. Fortunately the following link helped me recover by using Set-VHD with "ignoreidmismatch": chentiangemalc.wordpress.com/2017/06/15/…
    – Steve S
    Sep 17, 2019 at 12:39
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.

2
  • 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, 2015 at 7:15
  • 1
    Confirmed. Make sure you are using 'Enhanced Session' and not the 'Basic Session'. Jul 13, 2016 at 3:33
6

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.

1
  • This actually transfers data over the network, your're just using PowerShell Remoting instead of SMB or RDP.
    – Massimo
    Feb 20, 2020 at 20:55
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.

1
  • 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. Jul 2, 2019 at 21:04
0

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.

0
0
  1. On the VM machine open the Windows Group Policy Editor
    Type gpedit.msc in the Windows Run dialog Win+R
  2. Navigate to the folder "Device and Resource Redirection"
    Computer Configuration
          >  Administrative Templates
               >  Windows Components
                    >  Remote Desktop Services
                         >  Remote Desktop Host
                              >  Device and Resource Redirection
  3. Set the policy to Not configured or Disabled to allow file copy redirection in Remote Desktop Services and Hyper-V Enhanced Session Mode sessions.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .