From 9941294b0340b1cd559189e1de0b08aa87edfaeb Mon Sep 17 00:00:00 2001 From: Chris Blyth Date: Tue, 23 Aug 2022 10:28:49 +0100 Subject: [PATCH] (#2410) Update to escape single quote as well as double quotes. --- src/chocolatey/infrastructure.app/services/PowershellService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chocolatey/infrastructure.app/services/PowershellService.cs b/src/chocolatey/infrastructure.app/services/PowershellService.cs index 0faf6952d3..92ee18f603 100644 --- a/src/chocolatey/infrastructure.app/services/PowershellService.cs +++ b/src/chocolatey/infrastructure.app/services/PowershellService.cs @@ -165,7 +165,7 @@ private string get_script_arguments(string script, ChocolateyConfiguration confi private string prepare_powershell_arguments(string argument) { - return argument.to_string().Replace("\"", "\\\""); + return argument.to_string().Replace("\"", "\\\"").Replace("'", "\\'"); } public bool run_action(ChocolateyConfiguration configuration, PackageResult packageResult, CommandNameType command)