Git Bash and Command Prompt cannot see the VirtualBox shared folder on Windows 10 guest

When you start a Windows 10 guest machine in VirtualBox on your workstation, you can set up shared folders to seamlessly copy files between your workstation and the Windows 10 guest machine.

The shared folder appears in Windows Explorer as a mapped network location.

For more on this see Configure the Windows virtual machine in VirtualBox

On a Windows 7 guest machine the Git Bash, Command Prompt, and PowerShell windows all can see the mapped E: network drive, so you can change the working directory with

cd E:

and execute commands in the shared folders.

On a Windows 10 guest machine, only the PowerShell window can see the shared folder as a mapped network drive, E:


Command prompt will display the error message

The system cannot find the drive specified

When you try to start the Git Bash window with Git Bash Here, nothing happens.

If you start Git Bash from the menu and try to change the working directory to the E: drive, you get the error message

bash: cd: /e: No such file or directory


If you need to use the Command prompt, you can temporarily map the shared folder

  1. Open the Command Prompt on the Windows 10 guest machine
  2. Execute the command
net use x: \\vboxsvr\Users

Configure the Ubuntu virtual machine in VirtualBox

Enable shared folders on the virtual machines

To be able to use shared folders between the host ( your workstation ) and the virtual machine.

  • Start the Ubuntu virtual machine in Virtual Box,
  • Select the virtual machine window on your workstation,
  • In the Devices menu of Virtual Box select Insert Guest Additions CD image…
  • Click the Run button,
  • Enter your admin password and click Authenticate,
  • Select the terminal window and press Enter,

  • Restart the virtual machine for the change to take effect,
  • In Ubuntu
    1. Open a terminal window,
    2. In the upper left corner of the desktop click the Search icon,
    3. Type terminal into the search box,
    4. Select the Terminal icon.
  • In the Terminal window create a directory for the mount point
    mkdir ~/host-share
    sudo chmod 777 ~/host-share
  • Mount the Shared Windows location. Get the Machine Folder name from the virtual machine’s Shared Folders tab in VirtualBox

    (If you shared the root of a Windows C: drive, the name is “C_DRIVE”.)

    sudo mount -t vboxsf -o uid=$UID,gid=$(id -g) MY_MACHINE_FOLDER_NAME ~/host-share

Source: https://help.ubuntu.com/community/VirtualBox/SharedFolders

Make the mounting permanent

  1. Create the folder /opt/scripts
  2. Create a new file in the new folder mount_host_share
    #!/bin/sh
    # Mount the Host Share to see the host computer's file system
    echo MY_PASSWORD | sudo -S mount -t vboxsf -o uid=1000,gid=1000 MY_MACHINE_FOLDER_NAME ~/host-share
  3. Make the file executable
    chmod +x /opt/scripts/mount_host_share
  4. On the Ubuntu desktop click the Search icon and type startup, and click the Startup Applications icon
  5. On the Startup Applications Preferences window click Add,
  6. Enter the Name and this Command, and click Save
    /opt/scripts/mount_host_share

The shared drive appears in the File manager.

Relax the password requirement

The virtual machine is already protected by the operating system of the host, your workstation, so it is not necessary to enter the password every time you want to switch to the guest machine. To remove the password requirement

  1. Click the System Settings icon in the sidebar,
  2. Uncheck the Waking from suspend and Returning from blank screen checkboxes.

Configure the Windows virtual machine in VirtualBox

Enable shared folders on the virtual machine

To be able to use shared folders between the host ( your workstation ) and the Windows virtual machine.

  1. Start the Windows virtual machine in VirtualBox,
  2. Select the virtual machine window on your workstation,
  3. In the Devices menu of VirtualBox select Insert Guest Additions CD image…
  4. In the virtual machine start Windows Explorer,
  5. Open the VirtualBox Guest Additions CD,
  6. Start VBoxWindowsAdditions.exe,

  7. On the User Account Control popup click Yes,
  8. Click Next on the setup page,
  9. Click Next on the path selection page,
  10. Click the Install button,
  11. Save all your documents on the virtual machine, and allow the reboot of the virtual machine for the changes to take effect.

The shared folders will be available in the virtual machine’s Windows Explorer under Network locations as the E: drive

Important

Refresh

When an application copies or deletes files and folders in the displayed shared folder, click the Refresh button to see the new state of the directory. Windows usually does not refresh the view of the shared folder.

 

Command window

On a Windows 10 guest machine, the Git Bash and Command Prompt windows cannot see the mapped shared folders. To execute commands in shared folders, use the PowerShell window. For more see Git Bash and Command Prompt cannot see the VirtualBox shared folder on Windows 10 guest

VirtualBox installation and configuration on Windows

Download Virtual Box from https://www.virtualbox.org/wiki/Downloads and follow the instructions to install it.

At the time of writing this was the section where the installer files were referenced

virtual-box-01-download

Run the downloaded installer file and accept all default values.

The installer starts the Virtual Box application.You can close it, we will use other tools to start it in the future.

To be able to launch 64-bit guest operating systems turn off Hyper-V in Windows Features

  1. In the Windows search box enter Windows Features and select Turn Windows Features on or off,
  2. Uncheck Hyper-V and click OK,
  3. Reboot the computer for the setting to take effect.

Create a virtual machine

To create a new virtual machine

Download the  OS image from the manufacturer’s web site.

  1. Start the VirtualBox application
  2. Click the New icon
  3. Enter a name, select the operating system type and version, and set the memory size,
  4. Set the initial size of the virtual hard disk
  5. Select the virtual machine icon and click the Start button,
  6. Click the Browse icon and select the OS image file in the Downloads directory,
  7. Click the Start button

Configure VirtualBox for each virtual machine

 Networking

To share the connectivity of the host computer with the virtual machine, mainly if you use VPN

  1. In Virtual box click Settings
  2. Select Network
  3. Attach the network adapter to NAT

Copy and paste

To enable copy and paste between the virtual machine and the host ( your workstation )

  1. On the General tab of the Settings page select the Bidirectional shared clipboard

Shared Folders

Specify the shared folder on your workstation

  1. In the VirtualBox menu select Preferences
  2. On the Shared Folders tab click the + icon
  3. To share the entire system drive, select the C: drive of your workstation

Configure the virtual machine OS

To configure the virtual machine operating system in VirtualBox, see Virtual machine configuration on the VirtualBox page.

VirtualBox installation and configuration on Macintosh

Download VirtualBox from https://www.virtualbox.org/wiki/Downloads and follow the instructions to install it.

At the time of writing, this was the section where the installer files were referenced

virtual-box-01-download

Run the downloaded installer file and accept all default values.

The installer starts the application.

 

Create a virtual machine

To create a new virtual machine

Download the OS image from the manufacturer’s website.

  1. Start the VirtualBox application
  2. Click the New icon
  3. Click the Expert Mode button
  4. Enter the name, select the operating system type and version, and set the memory size,
  5. Set the initial size of the virtual hard disk, and click the Create button,
  6. Select the virtual machine icon and click the Start button
  7. Click the Browse icon and select the OS image file in the Downloads directory,
  8. Click the Start button,

Configure VirtualBox for each virtual machine

Networking

To share the connectivity of the host computer with the virtual machine, mainly if you use VPN

  1. In VirtualBox select the virtual machine icon and click Settings
  2. Select Network
  3. Attach the network adapter to NAT

If your company use automated software installation and updates, set up a second network connection using the Bridged Adapter. This way the virtual machine will get an independent IP address in the same IP address range as the host machine.

  1. Select the Adapter 2 tab,
  2. Select the Enable Network Adapter checkbox,
  3. Select the Bridged Adapter in the Attached to drop-down,
  4. In the Name drop-down list select the fastest network connection of the host machine.

Copy and paste

To enable copy and paste between the virtual machine and the host ( your workstation )

  1. On the General tab of the Settings page select the Bidirectional shared clipboard

Shared Folders

Specify the shared folder on your workstation

  • In the VirtualBox menu select Preferences
  • On the Shared Folders tab click the + icon
  • Select your home folder on your workstation

Configure the virtual machine OS

To configure the virtual machine operating system in VirtualBox, see Virtual machine configuration on the VirtualBox page.

Send CTRL-ALT-DELETE to a Windows Virtual Box computer from a Macintosh

When you start a Windows 7 or equivalent server machine, to log in, you need to press CTRL-ALT-DELETE on the keyboard to get the login page. To send Control-Alt-Delete to a Windows virtual machine in Virtual Box from a Macintosh

on a Macintosh laptop press the fn – Command  – Delete back  keys

on a Macintosh desktop press the Command  – Delete forward  keys.