[Bug]: Environment variables do not working in Mapped Folder
Windows Sandbox version
0.5.0.0
Windows build number
10.0.26100.0 | 24H2
Other software
No response
Steps to reproduce the bug
Run with this config:
<Configuration>
<MappedFolders>
<MappedFolder>
<HostFolder>%USERPROFILE%\workspace</HostFolder>
<SandboxFolder>C:\Users\WDAGUtilityAccount\workspace</SandboxFolder>
</MappedFolder>
</MappedFolders>
</Configuration>
Expected result
Correct mapping and working.
I can confirm it was working before, because I have multiple wsb configs that use environment variables in mapped folder, they were created in Aug, 2023.
And the documentation notes that:
... Beginning in Windows 11, version 23H2, you can use environment variables in the path.
https://learn.microsoft.com/en-us/windows/security/application-security/application-isolation/windows-sandbox/windows-sandbox-configure-using-wsb-file#mapped-folders
Actual result
Included System Information
No response
It looks like the path format has been restricted in the new version for some reason, this will works correctly.
<Configuration>
<MappedFolders>
<MappedFolder>
<HostFolder>C:\Users\%USERNAME%\workspace</HostFolder>
<SandboxFolder>C:\Users\WDAGUtilityAccount\workspace</SandboxFolder>
</MappedFolder>
</MappedFolders>
</Configuration>
Close if this is the expected behavior of program design.
This issue is resolved in the latest version of Windows Sandbox. Release date tbd, but I will update as soon as we have that information.