Shared folders using a bat file: how, when and where?
Posted: 11. Mar 2022, 13:10
Knowing that drag&drop does not always work well, while "shared folders" seem a more reliable way to connect guest with host and external drives, I was thinking a quick way to set this feature, when needed.
With the help manual and some posts from this forum I wrote the following bat file. I would be greateful if someone spots errors or gives suggestions to improve it.
The folder that I would like to share temporarily (i.e. when needed) is from a USB drive (with path "D:\my_external_path").
I ask here the following before messing up the VB machines with my attemps.
a) Can the bat file be run before launching the guest VM and it is safer to do so? In my testing in fact I see that the script asks theGuest VM needs to be open.
b) Is there a way to run a similar bat file within the Guest VM (it would be better: each Guest VM has its own bat file), instead from the host OS?
Thanks
With the help manual and some posts from this forum I wrote the following bat file. I would be greateful if someone spots errors or gives suggestions to improve it.
The folder that I would like to share temporarily (i.e. when needed) is from a USB drive (with path "D:\my_external_path").
Code: Select all
echo on
c:
cd "c:\Program files\VirtualBox\"
VBoxManage sharedfolder add "myVM_name" --name "mySharedFolders_name" --hostpath "D:\my_external_path" --transient --automount
pause
echo off
exita) Can the bat file be run before launching the guest VM and it is safer to do so? In my testing in fact I see that the script asks theGuest VM needs to be open.
b) Is there a way to run a similar bat file within the Guest VM (it would be better: each Guest VM has its own bat file), instead from the host OS?
Thanks