复制部分文件powershell

时间:2015-03-18 16:30:05

标签: powershell copy

我正在尝试将源exe文件的一部分复制到新的dst文件, 我使用以下commnads:

$file = (Get-Content src.exe)[31..111] | Set-Content dst.exe

但在输出文件中我得到额外的换行符号,当我尝试运行该文件时会导致错误。 如何复制文件的内部部分而不会损坏它。

我附上了一个不同的jpg。 请帮忙

enter image description here

1 个答案:

答案 0 :(得分:2)

$file = (Get-Content src.exe -encoding byte)[31..111] | Set-Content dst.exe -encoding byte