Upgrading from Parallels BE 11 to 12/13, uploading files changed

Discussion in 'Windows Virtual Machine' started by LawrenceC1, Feb 7, 2018.

  1. LawrenceC1

    LawrenceC1 Bit poster

    Messages:
    4
    Hi,

    So I'm currently using Parallels business edition 11, and have automated some processes for testing purposes. Part of these tests involve uploading files from my host Mac to the targeted Windows VM (in a Bash script using prlctl commands).
    In Parallels version 11, to upload a file I use the following command:
    ditto --norsrc --noacl --noqtn --noextattr "/Users/username/Downloads/test.txt" "/Users/username/Desktop/[C] Windows 7/tmp/"
    This would upload the file test.txt to the Windows VM and put it in C:/tmp/test.txt.

    When upgrading to either Parallels business edition 12 or 13, there seems to have been a change with file sharing between VMs which breaks the above. Instead of being able to put files directly onto the C:/ directory, instead it is redirected to a mounted shared folder (also called [C] Windows 7), which has something like \\mac\home\[C] Windows 7\, which is not where I want the file to be.

    I've tried mounting that location as a share drive, and then copying it across to the C:/ drive using something like:
    prlctl exec "Windows 7" copy "J:\\Desktop\\[C] Windows 7\\tmp\\test.txt" "C:\\tmp\\"
    however, this resolved with errors such as "The system cannot find the path specified." Even though the J: drive has been mounted.

    How can I upload a file from my host Mac, to the Windows VM using prlctl and place it in the C:/ directory? Would love to start using Parallels 12 or 13 instead of 11.

    Thanks!
     
  2. vasilyz

    vasilyz Parallels Developers

    Messages:
    84
    Best Answer
    The guest disk may be mounted with the following sequence:
    Code:
    sudo mkdir "/Volumes/[C] Windows 7"
    mount -t smbfs //Windows%207._smb._tcp.local/%5BC%5D%20Windows%207 "/Volumes/[C] Windows 7"
    You may use another directory outside of /Volumes for not being required to use 'sudo' to create it. Note that spaces, square braces and some other special characters in the URL must be percent-encoded. The URL before encoding is "//Windows 7._smb._tcp.local/[C] Windows 7".

    Alternatively you may copy the file without mounting by using prlctl exec along with enabled Parallels Shared Folders:
    Code:
    prlctl exec "Windows 7" cmd /c copy "\\\\Mac\\Home\\path\\to\\test.txt" "C:\\tmp\\test.txt"
    This way the command 'cmd /c copy' with its arguments is executed inside the guest OS.
    \\Mac\Home is your home folder from the guest's standpoint, so the rest part of the path is relative to your home folder on your Mac. To access a file outside your home folder use \\Mac\AllFiles instead. This is the root folder of your Mac from the guest's standpoint. The appropriate option has to be enabled in the VM config in this case.
     
    LawrenceC1 likes this.
  3. Dmitry@Parallels

    Dmitry@Parallels Parallels Team

    Messages:
    702
    Hi @LawrenceC1, once VM's file system is mounted to Finder, you can access Windows at /Volumes/ (attached the screenshot). Please use the path to Windows FS via /Volumes/ to copy files inside the VM.
     

    Attached Files:

    LawrenceC1 likes this.
  4. LawrenceC1

    LawrenceC1 Bit poster

    Messages:
    4
    Thanks - that resolved the issue!
    Is this just for Parallels 12 & 13, or was this format also used for 11 which I missed?
     
  5. LawrenceC1

    LawrenceC1 Bit poster

    Messages:
    4
    Another question actually about accessing Windows FS at /Volumes/

    If I revert to a previous snapshot (in an automated script), and then try to upload a file to /Volumes/[C] Windows 7/ it fails, because it says the directory doesn't exist.

    To resolve this, I have to manually go into the Shared folder in Finder, and click on the VM itself before it connects. (which then makes it appear when doing ls -l /Volumes/)

    Is there a way of doing the above manual step in terminal? ie, have whenever the VM start auto mount to the mac host at /Volumes/[C] Windows 7/?
     
  6. vasilyz

    vasilyz Parallels Developers

    Messages:
    84
    Best Answer
    The guest disk may be mounted with the following sequence:
    Code:
    sudo mkdir "/Volumes/[C] Windows 7"
    mount -t smbfs //Windows%207._smb._tcp.local/%5BC%5D%20Windows%207 "/Volumes/[C] Windows 7"
    You may use another directory outside of /Volumes for not being required to use 'sudo' to create it. Note that spaces, square braces and some other special characters in the URL must be percent-encoded. The URL before encoding is "//Windows 7._smb._tcp.local/[C] Windows 7".

    Alternatively you may copy the file without mounting by using prlctl exec along with enabled Parallels Shared Folders:
    Code:
    prlctl exec "Windows 7" cmd /c copy "\\\\Mac\\Home\\path\\to\\test.txt" "C:\\tmp\\test.txt"
    This way the command 'cmd /c copy' with its arguments is executed inside the guest OS.
    \\Mac\Home is your home folder from the guest's standpoint, so the rest part of the path is relative to your home folder on your Mac. To access a file outside your home folder use \\Mac\AllFiles instead. This is the root folder of your Mac from the guest's standpoint. The appropriate option has to be enabled in the VM config in this case.
     
    LawrenceC1 likes this.
  7. LawrenceC1

    LawrenceC1 Bit poster

    Messages:
    4
    Thanks for responding vasilyz - this is exactly what I was looking for!
     

Share This Page