diff --git a/provisioner/guest_commands.go b/provisioner/guest_commands.go index 3a361a208..ca2b238a4 100644 --- a/provisioner/guest_commands.go +++ b/provisioner/guest_commands.go @@ -30,7 +30,7 @@ var guestOSTypeCommands = map[string]guestOSTypeCommand{ mkdir: "powershell.exe -Command \"New-Item -ItemType directory -Force -ErrorAction SilentlyContinue -Path %s\"", removeDir: "powershell.exe -Command \"rm %s -recurse -force\"", statPath: "powershell.exe -Command { if (test-path %s) { exit 0 } else { exit 1 } }", - mv: "powershell.exe -Command \"mv %s %s\"", + mv: "powershell.exe -Command \"mv %s %s -force\"", }, } diff --git a/provisioner/guest_commands_test.go b/provisioner/guest_commands_test.go index 08baca058..ffbad4bbd 100644 --- a/provisioner/guest_commands_test.go +++ b/provisioner/guest_commands_test.go @@ -183,13 +183,13 @@ func TestMovePath(t *testing.T) { t.Fatalf("Failed to create new GuestCommands for OS: %s", WindowsOSType) } cmd = guestCmd.MovePath("C:\\Temp\\SomeDir", "C:\\Temp\\NewDir") - if cmd != "powershell.exe -Command \"mv C:\\Temp\\SomeDir C:\\Temp\\NewDir\"" { + if cmd != "powershell.exe -Command \"mv C:\\Temp\\SomeDir C:\\Temp\\NewDir -force\"" { t.Fatalf("Unexpected Windows remove dir cmd: %s", cmd) } // Windows OS w/ space in path cmd = guestCmd.MovePath("C:\\Temp\\Some Dir", "C:\\Temp\\New Dir") - if cmd != "powershell.exe -Command \"mv C:\\Temp\\Some` Dir C:\\Temp\\New` Dir\"" { + if cmd != "powershell.exe -Command \"mv C:\\Temp\\Some` Dir C:\\Temp\\New` Dir -force\"" { t.Fatalf("Unexpected Windows remove dir cmd: %s", cmd) } }