Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed all the Powershell calls to the "echo" cmdlet to use "out-file" with the "-append" option instead #35

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions winrmcp/cp.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func restoreContent(client *winrm.Client, fromPath, toPath string) error {
$writer.Close()
}
} else {
echo $null > $dest_file_path
out-file -FilePath $dest_file_path -Encoding utf8 -InputObject $null
}
`, fromPath, toPath)

Expand Down Expand Up @@ -213,7 +213,7 @@ func cleanupContent(client *winrm.Client, filePath string) error {
}

func appendContent(shell *winrm.Shell, filePath, content string) error {
cmd, err := shell.Execute(fmt.Sprintf("echo %s >> \"%s\"", content, filePath))
cmd, err := shell.Execute(fmt.Sprintf("out-file -FilePath \"%s\" -encoding utf8 -Append -InputObject \"%s\"", content, filePath))

if err != nil {
return err
Expand Down