diff --git a/goolib/goolib.go b/goolib/goolib.go index a5d6218..96c3866 100644 --- a/goolib/goolib.go +++ b/goolib/goolib.go @@ -31,7 +31,7 @@ import ( ) var interpreter = map[string]string{ - ".ps1": "powershell", + ".ps1": "powershell.exe", ".cmd": "cmd", ".bat": "cmd", ".exe": "cmd", @@ -60,7 +60,7 @@ func Exec(s string, args []string, ec []int, w io.Writer) error { return err } switch ipr { - case "powershell": + case "powershell.exe": // We are using `-Command` here instead of `-File` as this catches syntax errors in the script. args = append([]string{"-ExecutionPolicy", "Bypass", "-NonInteractive", "-NoProfile", "-Command", cs}, args...) c = exec.Command(ipr, args...) diff --git a/goolib/goolib_test.go b/goolib/goolib_test.go index 404dbda..8bbc553 100644 --- a/goolib/goolib_test.go +++ b/goolib/goolib_test.go @@ -26,7 +26,7 @@ func TestScriptInterpreter(t *testing.T) { script string eitp string }{ - {"/file/path/script.ps1", "powershell"}, + {"/file/path/script.ps1", "powershell.exe"}, {"/file/path/script.cmd", "cmd"}, {"/file/path/script.bat", "cmd"}, }