Skip to content

Commit

Permalink
RunInSandbox.ps1: adjusted Expand-Archive command for ZIP handling to…
Browse files Browse the repository at this point in the history
… use Base64 encoding, in order to avoid character escaping issues
  • Loading branch information
samnorr committed Jan 20, 2024
1 parent 33b7f95 commit fa63363
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Sources/Run_in_Sandbox/RunInSandbox.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,11 @@ switch ($Type) {
New-WSB -Command_to_Run $Startup_Command
}
"ZIP" {
$Script:Startup_Command = $PSRun_Command + " " + "`"Expand-Archive '$Full_Startup_Path' '$Sandbox_Desktop_Path\ZIP_extracted'`""
$command = "Expand-Archive -LiteralPath '$Full_Startup_Path' -DestinationPath '$Sandbox_Desktop_Path\ZIP_extracted'"
$bytes = [System.Text.Encoding]::Unicode.GetBytes($command)
$encodedCommand = [Convert]::ToBase64String($bytes)

$Script:Startup_Command = "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -sta -WindowStyle Hidden -NoProfile -ExecutionPolicy Unrestricted -EncodedCommand " + $encodedCommand
New-WSB -Command_to_Run $Startup_Command
}
}
Expand Down

0 comments on commit fa63363

Please sign in to comment.