This tutorial will show you how to share host folders with read or write permissions in Windows Sandbox for your account in Windows 11.
Windows Sandbox provides a lightweight desktop environment to safely run applications in isolation. Software installed inside the Windows Sandbox environment remains "sandboxed" and runs separately from the host machine.
A sandbox is temporary. When it's closed, all the software and files and the state are deleted. You get a brand-new instance of the sandbox every time you open the app.
You can use a Windows Sandbox configuration (.wsb) file to share folders from the host with read or write permissions.
Starting with Windows 11 build 27686.1000 (Canary), this build includes the new Windows Sandbox Client Preview that is now updated via the Microsoft Store. As part of this preview, Microsoft is introducing runtime clipboard redirection, audio/video input control, and the ability to share folders with the host at runtime. You can access these via the new “…” icon at the upper right on the app. Additionally, this preview includes a super early version of command line support (commands may change over time). You can use ‘wsb.exe –help’ command for more information.
Reference:
Windows Sandbox is only available in the Windows 11 Pro, Enterprise, and Education editions.
Exposing host directories might allow malicious software to affect the system or steal data.
- Option One: Share Host Folder(s) with Windows Sandbox at Runtime
- Option Two: Share Host Folder(s) with Windows Sandbox using WSB file
This option is only available starting with Windows 11 build 27686.1000 (Canary).
1 Open the Windows Sandbox app.
2 Click/tap on the 3 dots icon at the upper right, and click/tap on Share folder. (see screenshot below)
3 Navigate to and select the host folder you want to share, and click/tap on Select Folder. (see screenshot below)
4 Repeat steps 2 and 3 if you want to share any other host folder(s) with Windows Sandbox.
5 The shared host folder(s) will now appear on the desktop of Windows Sandbox until you close Windows Sandbox. (see screenshot below)
The .wsb file created using this option acts as a shortcut to open Windows Sandbox with the specified shared host folder(s) always available.
1 On the host (not Windows Sandbox), create a new text file where (ex: Desktop) you want to use it as a shortcut from, and name it MappedFolders.wsb.
You can name the text file anything you want, but you must change the .txt file extension to .wsb.
2 Right click on the MappedFolders.wsb file, and click/tap on Edit in Notepad.
3 Copy and paste the code you want to use below into the MappedFolders.wsb file opened in Notepad.
<Configuration>
<MappedFolders>
<MappedFolder>
<HostFolder>Full path to folder</HostFolder>
<ReadOnly>true</ReadOnly>
</MappedFolder>
</MappedFolders>
</Configuration>
<Configuration>
<MappedFolders>
<MappedFolder>
<HostFolder>Full path to folder</HostFolder>
<ReadOnly>false</ReadOnly>
</MappedFolder>
</MappedFolders>
</Configuration>
4 Edit the line below to change Full path to folder with the actual full path of the host folder you want to share in Windows Sandbox.
<HostFolder>Full path to folder</HostFolder>
<HostFolder>C:\Users\Brink\Downloads</HostFolder>
5 If you want to share multiple host folders, you can add another section below to the code for each folder you want and each with read-only (true) or write (false) permissions
<MappedFolder>
<HostFolder>Full path to folder</HostFolder>
<ReadOnly>false</ReadOnly>
</MappedFolder>
<MappedFolder>
<HostFolder>Full path to folder</HostFolder>
<ReadOnly>true</ReadOnly>
</MappedFolder>
EXAMPLE of code for three shared host folders:
<Configuration>
<MappedFolders>
<MappedFolder>
<HostFolder>Full path to folder1</HostFolder>
<ReadOnly>false</ReadOnly>
</MappedFolder>
<MappedFolder>
<HostFolder>Full path to folder2</HostFolder>
<ReadOnly>true</ReadOnly>
</MappedFolder>
<MappedFolder>
<HostFolder>Full path to folder3</HostFolder>
<ReadOnly>false</ReadOnly>
</MappedFolder>
</MappedFolders>
</Configuration>
6 When finished editing the code in the MappedFolders.wsb file opened in Notepad, click/tap on File on the menu bar, and click/tap on Save. (see screenshots below).
7 You can now run this MappedFolders.wsb file anytime you want to open Windows Sandbox with the shared host folder(s) available on the desktop of Windows Sandbox.
That's it,
Shawn Brink
- Enable or Disable Windows Sandbox in Windows 11
- Enable or Disable Share Host Folders with Windows Sandbox in Windows 11
- Enable or Disable Clipboard Sharing with Windows Sandbox in Windows 11
- Enable or Disable Audio Input in Windows Sandbox in Windows 11
- Enable or Disable Networking in Windows Sandbox in Windows 11
- Enable or Disable Printer Sharing with Windows Sandbox in Windows 11
- Enable or Disable vGPU Sharing for Windows Sandbox in Windows 11
- Enable or Disable Video Input in Windows Sandbox in Windows 11