From 4a2566c646cd8116550507219f8cd9f4e98907a1 Mon Sep 17 00:00:00 2001 From: "William E. Triest. III" Date: Thu, 7 Aug 2014 08:49:36 -0400 Subject: [PATCH] Fixes 4309 When the winrm communicator executes a command in an elevated shell, this patch causes it to escape double quotes. This is necessary as the first line in the file that it produces and then executes it puts the command into a variable called command that is delimited by double quotes. --- plugins/communicators/winrm/communicator.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/communicators/winrm/communicator.rb b/plugins/communicators/winrm/communicator.rb index 5ce188229..7609f16b3 100644 --- a/plugins/communicators/winrm/communicator.rb +++ b/plugins/communicators/winrm/communicator.rb @@ -125,7 +125,7 @@ module VagrantPlugins script = Vagrant::Util::TemplateRenderer.render(path, options: { username: shell.username, password: shell.password, - command: command, + command: command.gsub("\"", "`\""), }) guest_script_path = "c:/tmp/vagrant-elevated-shell.ps1" file = Tempfile.new(["vagrant-elevated-shell", "ps1"])