Copy files to Windows 10 Sandbox shared folder and start Sandbox

Windows 10 Pro & Enterprise have an integrated Sandbox. For enabling the Sandbox follow this windowscentral tutorial.

The Sandbox can be configured so that it uses shared folders. For configuration examples have a look here.

The config (*.wsb) files are xml files which when opened start the Sandbox with the config stored in that wsb file.

My config file looks like that. It only provides one shared folder mapping from my ramdisk T:\ to the Desktop of the Sandbox. By that the shared files are directly visible when the Sandbox starts.

<Configuration>
<VGpu>Disable</VGpu>
<MappedFolders>
  <MappedFolder> 
    <HostFolder>T:\SandboxShare</HostFolder> 
    <SandboxFolder>C:\users\WDAGUtilityAccount\Desktop</SandboxFolder>
  </MappedFolder>
</MappedFolders>
</Configuration>

My button now is pretty simple. It copies the selected files to my ramdisk (shared folder on host) and then starts the config file.
For it to work for you, adjust the filepaths that apply to your machine.

Copy TO T:\SandboxShare UNATTENDED=yes 
"D:\SandboxSharedFolder.wsb" 

The same commands in XML format so you get the icons etc. (see How to use buttons and scripts from this forum for how to use it):

<?xml version="1.0"?>
<button backcol="none" display="both" hotkey="ctrl+alt+S" label_pos="right" textcol="none">
	<label>Copy to Sandbox</label>
	<icon1>/system/WindowsSandbox.exe,0</icon1>
	<function type="normal">
		<instruction>Copy TO T:\SandboxShare UNATTENDED=yes </instruction>
		<instruction>@async &quot;D:\SandboxSharedFolder.wsb&quot; </instruction>
	</function>
</button>

I use this button for testing software quickly inside the sandbox without having to handle the copy paste procedure myself.

For having an environment where programs should be installed inside the Sandbox and then transferred to the host (i do this to make apps portable without installing them on the host machine), i updated the script and config so that two shared folders for desktop and programs are created, the file is copied to the sandbox desktop, and the lister tab on the host machine goes to the shared programs folder, where you then can copy the program files after the setup has finished.
Im not yet sure if it can lead to problems that C:\Program Files (x86) and C:\Program Files are mapped to the same shared folder on the host machine.

<?xml version="1.0"?>
<button backcol="none" display="both" hotkey="ctrl+alt+S" label_pos="right" textcol="none">
	<label>Copy to Sandbox</label>
	<icon1>/system/WindowsSandbox.exe,0</icon1>
	<function type="normal">
		<instruction>CreateFolder T:\SandboxShare\Desktop </instruction>
		<instruction>CreateFolder T:\SandboxShare\Programme</instruction>
		<instruction>Copy TO T:\SandboxShare\Desktop</instruction>
		<instruction>@async &quot;D:\SandboxSharedFolder.wsb&quot;</instruction>
		<instruction>Go T:\SandboxShare\Programme </instruction>
	</function>
</button>

and the SandboxSharedFolder.wsb

<Configuration>
<MappedFolders>
  <MappedFolder> 
    <HostFolder>T:\SandboxShare\Desktop</HostFolder> 
    <SandboxFolder>C:\users\WDAGUtilityAccount\Desktop</SandboxFolder>
    <ReadOnly>false</ReadOnly>
  </MappedFolder>
  <MappedFolder> 
    <HostFolder>T:\SandboxShare\Programme</HostFolder> 
    <SandboxFolder>C:\Program Files</SandboxFolder>
    <ReadOnly>false</ReadOnly>
  </MappedFolder>
  <MappedFolder> 
    <HostFolder>T:\SandboxShare\Programme</HostFolder> 
    <SandboxFolder>C:\Program Files (x86)</SandboxFolder>
    <ReadOnly>false</ReadOnly>
  </MappedFolder>
</MappedFolders>
</Configuration>