Skip to content

Commit

Permalink
Dont prefix ProgressPreference to PS scripts with begin..end (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
kke authored Feb 18, 2021
1 parent 6165ecc commit 0f599ce
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion powershell/powershell.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ func UploadCmd(path string) string {

// EncodeCmd base64-encodes a string in a way that is accepted by PowerShell -EncodedCommand
func EncodeCmd(psCmd string) string {
psCmd = "$ProgressPreference='SilentlyContinue'; " + psCmd
if !strings.Contains(psCmd, "begin {") {
psCmd = "$ProgressPreference='SilentlyContinue'; " + psCmd
}
// 2 byte chars to make PowerShell happy
wideCmd := ""
for _, b := range []byte(psCmd) {
Expand Down

0 comments on commit 0f599ce

Please sign in to comment.